diff --git a/src/cal_tools/tools.py b/src/cal_tools/tools.py index 4613e111fcc3e2036a636ad26eaeb4fa8c23e608..fdc177da4dae15cd2f29cf07d5d0bb8bbcc2b8ab 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 "