We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 059c775 commit 51652bbCopy full SHA for 51652bb
1 file changed
ayon_api/utils.py
@@ -178,6 +178,17 @@ def raise_for_status(self, message=None):
178
except requests.exceptions.HTTPError as exc:
179
if message is None:
180
message = str(exc)
181
+
182
+ # Get 'detail' from response.json() if possible because it'll be
183
+ # more descriptive than default http error message
184
+ try:
185
+ detail = exc.response.json()["detail"]
186
+ except (AttributeError, KeyError):
187
+ pass
188
+ else:
189
+ if detail:
190
+ message = f"{message}\n\tDetail: {detail}"
191
192
raise HTTPRequestError(message, exc.response)
193
194
def __enter__(self, *args, **kwargs):
0 commit comments