Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace logger.exit(...) from the internals #155

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading