Skip to content
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
16 changes: 3 additions & 13 deletions jbi/jira/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging
from typing import Collection, Iterable, Optional

Expand Down Expand Up @@ -64,18 +63,9 @@ def raise_for_status(self, *args, **kwargs):
response.reason,
extra={"body": response.text},
)
if str(exc) == "":
# Some Jira errors are raised as `HTTPError('')`.
# We are trying to turn them into insightful errors here.
try:
content = exc.response.json()
errors = content.get("errors", {})
response_details = ",".join(f"{k}: {v}" for k, v in errors.items())
except json.JSONDecodeError:
response_details = exc.response.text
# Set the exception message so that its str version contains details.
msg = f"HTTP {exc.response.status_code}: {response_details}"
exc.args = (msg,) + exc.args[1:]
# Set the exception message so that its str version contains details.
msg = f"HTTP {exc.response.status_code}: {exc}"
exc.args = (msg,) + exc.args[1:]
raise

get_server_info = instrumented_method(Jira.get_server_info)
Expand Down
Loading