Skip to content

Commit

Permalink
Replace logger.exit(...) from the internals
Browse files Browse the repository at this point in the history
Replace with raise ValueError instead so that the caller has the option to
handle the problem as they desire.

Fixes: #154
  • Loading branch information
xarses committed Sep 14, 2024
1 parent 5d7b80d commit fda9d0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion oras/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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 fda9d0b

Please sign in to comment.