Skip to content

Commit

Permalink
Added more descriptive error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekFurstPitt committed Mar 5, 2024
1 parent fccd32f commit b5a8813
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,14 @@ def get_entities_instanceof(id, type):
try:
uuid = schema_manager.get_hubmap_ids(id.strip())['uuid']
instanceof: bool = schema_manager.entity_instanceof(uuid, type)
except requests.exceptions.RequestException as e:
status_code = e.response.status_code
if status_code == 400:
bad_request_error(e.response.text)
if status_code == 404:
not_found_error(e.response.text)
else:
internal_server_error(e.response.text)
except:
bad_request_error("Unable to process request")
return make_response(jsonify({'instanceof': instanceof}), 200)
Expand Down

0 comments on commit b5a8813

Please sign in to comment.