Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.
Merged
Changes from 1 commit
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
15 changes: 7 additions & 8 deletions src/cli/onefuzz/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,16 @@ def request(
if response.status_code // 100 != 2:
try:
json = response.json()
# attempt to read as https://www.rfc-editor.org/rfc/rfc7807
if isinstance(json, Dict):
title = json.get("title")
details = json.get("detail")
raise Exception(
f"request did not succeed ({response.status_code}: {title}): {details}"
)
except requests.exceptions.JSONDecodeError:
pass

# attempt to read as https://www.rfc-editor.org/rfc/rfc7807
if isinstance(json, Dict):
title = json.get("title")
details = json.get("detail")
raise Exception(
f"request did not succeed ({response.status_code}: {title}): {details}"
)

error_text = str(
response.content, encoding="utf-8", errors="backslashreplace"
)
Expand Down