From 9922d65dc154297111aa5687d32b42ae94fec26f Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Wed, 16 Feb 2022 16:10:03 +0100 Subject: [PATCH] Add creating calibration_constant_version to refactored error condition --- src/cal_tools/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cal_tools/tools.py b/src/cal_tools/tools.py index 4613e111f..fdc177da4 100644 --- a/src/cal_tools/tools.py +++ b/src/cal_tools/tools.py @@ -703,7 +703,12 @@ def send_to_db(db_module: str, karabo_id: str, constant, condition, raise except Exception as e: # TODO: refactor to use custom exception class - if "has already been taken" in str(e): + # Refactor error message for re-injecting an + # identical CCV to the database. + if all(s in str(e) for s in [ + "Error creating calibration_constant_version", + "has already been taken", + ]): print( f"WARNING: {constant.name} for {db_module}" " has already been injected with the same " -- GitLab