Skip to content
Snippets Groups Projects
Commit 2f505864 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Improve exception formatting and remove unneeded logging

parent bc6fc810
No related branches found
No related tags found
1 merge request!12Adjustments and fixes for attribute_wrapper merge
...@@ -90,7 +90,7 @@ class OPCUAConnection(CommClient): ...@@ -90,7 +90,7 @@ class OPCUAConnection(CommClient):
try: try:
self.client.disconnect() self.client.disconnect()
except Exception as e: except Exception as e:
self.streams.error_stream("Disconnect from OPC-UA server %s failed: %s", self._servername(), e) self.streams.error_stream("Disconnect from OPC-UA server {} failed: {}".format(self._servername(), e))
def ping(self): def ping(self):
""" """
...@@ -99,7 +99,7 @@ class OPCUAConnection(CommClient): ...@@ -99,7 +99,7 @@ class OPCUAConnection(CommClient):
try: try:
self.client.send_hello() self.client.send_hello()
except Exception as e: except Exception as e:
raise Exception("Lost connection to server %s: %s", self._servername(), e) raise Exception("Lost connection to server {}.".format(self._servername())) from e
def _setup_annotation(self, annotation): def _setup_annotation(self, annotation):
""" """
...@@ -115,13 +115,12 @@ class OPCUAConnection(CommClient): ...@@ -115,13 +115,12 @@ class OPCUAConnection(CommClient):
elif isinstance(annotation, list): elif isinstance(annotation, list):
path = annotation path = annotation
else: else:
raise Exception("OPC-ua mapping requires either a list of the path or dict with the path. Was given %s type containing: %s", type(annotation), annotation) raise Exception("OPC-ua mapping requires either a list of the path or dict with the path. Was given {} type containing: {}".format(type(annotation), annotation))
try: try:
node = self.obj.get_child(path) node = self.obj.get_child(path)
except Exception as e: except Exception as e:
self.streams.error_stream("Could not get node: %s on server %s: %s", path, self._servername(), e) raise Exception("Could not get node: {} on server {}".format(path, self._servername())) from e
raise Exception("Could not get node: %s on server %s", path, self._servername()) from e
return node return node
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment