Skip to content

Commit

Permalink
Merge pull request #107 from ynput/bugfix/raise-defined-exception-whe…
Browse files Browse the repository at this point in the history
…n-response-not-available

Handle case when response does not have original respose
  • Loading branch information
iLLiCiTiT authored Nov 1, 2023
2 parents d4894b4 + ebe0dd7 commit 870a18b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ayon_api/server_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def status_code(self):
return self.status

def raise_for_status(self, message=None):
if self._response is None:
if self._data and self._data.get("detail"):
raise ServerError(self._data["detail"])
raise ValueError("Response is not available.")

try:
self._response.raise_for_status()
except requests.exceptions.HTTPError as exc:
Expand Down

0 comments on commit 870a18b

Please sign in to comment.