Skip to content

Commit

Permalink
Enable api_connector to return error message in text attribute
Browse files Browse the repository at this point in the history
Some API error responses contain the error message in the `text`
attribute, so this update makes it possible to fetch that message if
it exists.
  • Loading branch information
austinweisgrau committed Oct 25, 2023
1 parent 5ae1c5b commit 28949a9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions parsons/utilities/api_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def validate_response(self, resp):
if resp.status_code >= 400:
if resp.reason:
message = f"HTTP error occurred ({resp.status_code}): {resp.reason}"
elif resp.text:
message = f"HTTP error occurred ({resp.status_code}): {resp.text}"
else:
message = f"HTTP error occurred ({resp.status_code})"

Expand Down

0 comments on commit 28949a9

Please sign in to comment.