From fccd32fa1951f252d4bd1cf8ceab949813cd6803 Mon Sep 17 00:00:00 2001 From: DerekFurstPitt Date: Tue, 27 Feb 2024 15:02:13 -0500 Subject: [PATCH 1/2] converted hubmapid to uuid before running schema_manager.entity_instanceof() --- src/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app.py b/src/app.py index da426817..3488cdf3 100644 --- a/src/app.py +++ b/src/app.py @@ -471,7 +471,8 @@ def get_ancestor_organs(id): @app.route('/entities//instanceof/', methods=['GET']) def get_entities_instanceof(id, type): try: - instanceof: bool = schema_manager.entity_instanceof(id, type) + uuid = schema_manager.get_hubmap_ids(id.strip())['uuid'] + instanceof: bool = schema_manager.entity_instanceof(uuid, type) except: bad_request_error("Unable to process request") return make_response(jsonify({'instanceof': instanceof}), 200) From b5a881345733285564b38789a568208b090bd2dc Mon Sep 17 00:00:00 2001 From: DerekFurstPitt Date: Tue, 5 Mar 2024 07:33:43 -0500 Subject: [PATCH 2/2] Added more descriptive error handling. --- src/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app.py b/src/app.py index 3488cdf3..b029e065 100644 --- a/src/app.py +++ b/src/app.py @@ -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)