Skip to content

Commit

Permalink
Merge pull request #155 from xarses/raise_logger
Browse files Browse the repository at this point in the history
Replace logger.exit(...) from the internals
  • Loading branch information
vsoch authored Sep 15, 2024
2 parents 5d7b80d + c761fcf commit 4d248a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions oras/auth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import requests

from oras.logger import logger

from .basic import BasicAuth
from .token import TokenAuth

Expand All @@ -11,7 +9,7 @@
def get_auth_backend(name="token", session=None, **kwargs):
backend = auth_backends.get(name)
if not backend:
logger.exit(f"Authentication backend {backend} is not known.")
raise ValueError(f"Authentication backend {backend} is not known.")
backend = backend(**kwargs)
backend.session = session or requests.Session()
return backend
2 changes: 1 addition & 1 deletion oras/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def do_request(
# Otherwise, authenticate the request and retry
headers, changed = self.auth.authenticate_request(response, headers)
if not changed:
logger.exit("Cannot respond to request for authentication.")
raise ValueError("Cannot respond to request for authentication.")
response = self.session.request(
method,
url,
Expand Down

0 comments on commit 4d248a8

Please sign in to comment.