From b3b7973ffc36261dc6d79be17c85efbd79c317fa Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 14 Jul 2025 14:15:59 -0500 Subject: Handle case where authorisation is already set up. --- scripts/load_phenotypes_to_db.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py index 8855c4c..c1a7687 100644 --- a/scripts/load_phenotypes_to_db.py +++ b/scripts/load_phenotypes_to_db.py @@ -313,10 +313,18 @@ def update_auth(# pylint: disable=[too-many-locals,too-many-positional-arguments }).then(lambda attc: (user, linkeddata, resource, attc)) def __handle_error__(resp): + error = resp.json() + if error.get("error") == "IntegrityError": + # This is hacky. If the auth already exists, something went wrong + # somewhere. + # This needs investigation to recover correctly. + logger.info( + "The authorisation for the data was already set up.") + return 0 logger.error("ERROR: Updating the authorisation for the data failed.") logger.debug( "ERROR: The response from the authorisation server was:\n\t%s", - resp.json()) + error) return 1 def __handle_success__(_val): -- cgit v1.2.3