diff --git a/devices/toolkit/archiver.py b/devices/toolkit/archiver.py index 38ab8a27e9ce6d3fd9a80143017b8b9561e42405..0991b05c6fac220a786b90bc922032f130785c12 100644 --- a/devices/toolkit/archiver.py +++ b/devices/toolkit/archiver.py @@ -217,14 +217,11 @@ class Archiver(): """ Update the archiving properties of an attribute already in a subscriber list """ - try: - self.remove_attribute_from_archiver(attribute_name) - time.sleep(1) - self.add_attribute_to_archiver(attribute_name,polling_period,event_period,strategy) - time.sleep(1) - self.start_archiving_attribute(attribute_name) - except Exception as e: - raise Exception from e + self.remove_attribute_from_archiver(attribute_name) + time.sleep(1) + self.add_attribute_to_archiver(attribute_name,polling_period,event_period,strategy) + time.sleep(1) + self.start_archiving_attribute(attribute_name) def get_subscriber_attributes(self,es_name:str = None): """ @@ -353,7 +350,7 @@ class Retriever(): try: [domain, family, member] = device_fqname.split('/') except: - raise AttributeFormatException + raise AttributeFormatException(f"Could not parse device name {device_fqname}. Please provide FQDN, e.g. LTS/Device/1") attrs = self.session.query(Attribute).filter(and_(Attribute.domain == domain, Attribute.family == family, \ Attribute.member == member)).all() # Returns the representation as set in __repr__ method of the mapper class @@ -366,7 +363,7 @@ class Retriever(): try: [domain, family, member, name] = attribute_fqname.split('/') except: - raise AttributeFormatException + raise AttributeFormatException(f"Could not parse attribute name {attribute_fqname}. Please provide FQDN, e.g. LTS/Device/1/Attribute") try: result = self.session.query(Attribute.att_conf_id).filter(and_(Attribute.domain == domain, Attribute.family == family, \ Attribute.member == member, Attribute.name == name)).one() @@ -385,7 +382,7 @@ class Retriever(): try: [domain, family, member, name] = attribute_fqname.split('/') except: - raise AttributeFormatException + raise AttributeFormatException(f"Could not parse attribute name {attribute_fqname}. Please provide FQDN, e.g. LTS/Device/1/Attribute") try: result = self.session.query(DataType.data_type).join(Attribute,Attribute.att_conf_data_type_id==DataType.att_conf_data_type_id).\ filter(and_(Attribute.domain == domain, Attribute.family == family, Attribute.member == member, Attribute.name == name)).one() @@ -419,8 +416,6 @@ class Retriever(): base_class.data_time <= time_now_db)).order_by(base_class.data_time).all() except AttributeError as e: raise Exception(f"Empty result! Attribute {attribute_fqname} not found") from e - except Exception as e: - raise Exception from e return result def get_attribute_value_by_interval(self,attribute_fqname: str, start_time: datetime, stop_time: datetime): @@ -441,7 +436,5 @@ class Retriever(): base_class.data_time <= str(stop_time))).order_by(base_class.data_time).all() except AttributeError as e: raise Exception(f"Empty result! Attribute {attribute_fqname} not found") from e - except Exception as e: - raise Exception from e return result