diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py index 35b718f817e16d8b5fc4069d5ce3813efc6df1e9..7a62c18fd3973a8d0bb03641aa94336dff4ed870 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py @@ -186,11 +186,11 @@ class Archiver(): if es.state() == DevState.FAULT: raise Exception(f"Event Subscriber {es_name} is in FAULT state") self.cm.ArchiverAdd(device_name_url(es_name)) - except Exception as e: - if 'already_present' in str(e): + except DevFailed as e: + if e.args[0].reason == "Archiver already present": logger.warning(f"Event Subscriber {es_name} already present in Configuration Manager") else: - raise Exception from e + raise def add_attribute_to_archiver(self, attribute_name: str, polling_period: int, event_period: int, strategy: str = 'RUN', es_name:str=None): """