Skip to content
Snippets Groups Projects
Commit 7d562f8a authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-412: Cleanup duplication of comments and logging.

parent 1e5ee8c2
No related branches found
No related tags found
1 merge request!142L2SS-412: Use asyncio for opcua and other clients
...@@ -154,20 +154,15 @@ class attribute_wrapper(attribute): ...@@ -154,20 +154,15 @@ class attribute_wrapper(attribute):
try: try:
self.read_function, self.write_function = client.setup_attribute(self.comms_annotation, self) self.read_function, self.write_function = client.setup_attribute(self.comms_annotation, self)
except Exception as e: except Exception as e:
logger.error("Exception while setting {} attribute with annotation: '{}' {}".format(client.__class__.__name__, self.comms_annotation, e))
raise Exception("Exception while setting %s attribute with annotation: '%s'", client.__class__.__name__, self.comms_annotation) from e raise Exception("Exception while setting %s attribute with annotation: '%s'", client.__class__.__name__, self.comms_annotation) from e
async def async_set_comm_client(self, client): async def async_set_comm_client(self, client):
""" """
takes a communications client as input arguments This client should be of a class containing a "get_mapping" function Asynchronous version of set_comm_client.
and return a read and write function that the wrapper will use to get/set data.
""" """
try: try:
self.read_function, self.write_function = await client.setup_attribute(self.comms_annotation, self) self.read_function, self.write_function = await client.setup_attribute(self.comms_annotation, self)
except Exception as e: except Exception as e:
logger.error("Exception while setting {} attribute with annotation: '{}' {}".format(client.__class__.__name__, self.comms_annotation, e))
raise Exception("Exception while setting %s attribute with annotation: '%s'", client.__class__.__name__, self.comms_annotation) from e raise Exception("Exception while setting %s attribute with annotation: '%s'", client.__class__.__name__, self.comms_annotation) from e
def set_pass_func(self): def set_pass_func(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment