in jbi/jira/client.py [0:0]
def raise_for_status(self, *args, **kwargs):
"""Catch and log HTTP errors responses of the Jira self.client.
Without this the actual requests and responses are not exposed when an error
occurs, which makes troubleshooting tedious.
"""
try:
return super().raise_for_status(*args, **kwargs)
except requests.HTTPError as exc:
request = exc.request
response = exc.response
assert response is not None, f"HTTPError {exc} has no attached response"
atlassian_logger.error(
"HTTP: %s %s -> %s %s",
request.method,
request.path_url,
response.status_code,
response.reason,
extra={"body": response.text},
)
# Set the exception message so that its str version contains details.
msg = f"{request.method} {request.path_url} -> HTTP {response.status_code}: {exc}"
exc.args = (msg,) + exc.args[1:]
raise