From 2fa3c4f5f67efca838d6a93fd5e4d6050ce27801 Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Fri, 2 Apr 2021 13:06:18 +0200 Subject: [PATCH] modified attribute wrapper read/write function exception --- devices/clients/opcua_connection.py | 4 ---- devices/src/attribute_wrapper.py | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/devices/clients/opcua_connection.py b/devices/clients/opcua_connection.py index e88034192..1d1b1004c 100644 --- a/devices/clients/opcua_connection.py +++ b/devices/clients/opcua_connection.py @@ -142,7 +142,6 @@ class OPCUAConnection(CommClient): MANDATORY function: is used by the attribute wrapper to get read/write functions. must return the read and write functions """ - # process the annotation node = self._setup_annotation(annotation) @@ -202,7 +201,4 @@ class ProtocolAttribute: self.node.set_data_value(opcua.ua.uatypes.Variant(value=value, varianttype=self.ua_type)) - def pass_func(self, value=None): - pass - diff --git a/devices/src/attribute_wrapper.py b/devices/src/attribute_wrapper.py index 8a203eb36..436e7dba1 100644 --- a/devices/src/attribute_wrapper.py +++ b/devices/src/attribute_wrapper.py @@ -130,12 +130,14 @@ class attribute_wrapper(attribute): """ try: self.read_function, self.write_function = client.setup_attribute(self.comms_annotation, self) - except: + except Exception as e: def pass_func(value=None): pass - print("setting comm_client failed. using pass function instead") + logger.error("setting comm_client failed. using pass function instead") self.read_function = pass_func self.write_function = pass_func + raise Exception("Exception while setting comm_client read/write functions. using pass function instead. %s") from e + -- GitLab