diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py index d822d729ca9f1ab6f07caebd52ef57469aa56635..35b718f817e16d8b5fc4069d5ce3813efc6df1e9 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py @@ -208,11 +208,11 @@ class Archiver(): self.cm.write_attribute('SetPeriodEvent', event_period) self.cm.AttributeAdd() logger.info(f"Attribute {attribute_name} added to archiving list!") - except Exception as e: - if 'already archived' not in str(e).lower(): - raise Exception from e - else: + except DevFailed as e: + if e.args[0].reason == 'Already archived': logger.warning(f"Attribute {attribute_name} already in archiving list!") + else: + raise def add_attributes_by_device(self,device_name,global_archive_period:int = None, es_name:str=None, exclude:list = []): """