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

Bugfix: JSONDecodeError handling for simplejson #354

Merged
merged 3 commits into from
Jul 4, 2022
Merged
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
6 changes: 2 additions & 4 deletions dohq_artifactory/exception.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from json import JSONDecodeError

import requests


class ArtifactoryException(Exception):
pass


def raise_for_status(response):
def raise_for_status(response: requests.Response) -> None:
"""
Custom raise_for_status method.
Raises ArtifactoryException with clear message and keeps cause
Expand All @@ -25,7 +23,7 @@ def raise_for_status(response):
try:
response_json = exception.response.json()
error_list = response_json.pop("errors", None)
except JSONDecodeError:
except requests.compat.JSONDecodeError:
# not a JSON response
raise ArtifactoryException(str(exception)) from exception

Expand Down