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

Use () syntax behind wrappers for consistency with Tango/SKA wrappers

parent 1cc99173
No related branches found
No related tags found
1 merge request!7Resolve #2021 "03 16 branched from master elk stack"
......@@ -61,7 +61,7 @@ class hardware_device(Device):
self.value_dict = {i: i.initial_value() for i in self.attr_list()}
@log_exceptions
@log_exceptions()
def init_device(self):
""" Instantiates the device in the OFF state. """
......@@ -165,7 +165,7 @@ class hardware_device(Device):
"""Method always executed before any TANGO command is executed."""
pass
@log_exceptions
@log_exceptions()
def delete_device(self):
"""Hook to delete resources allocated in init_device.
......
......@@ -54,15 +54,18 @@ def device_logging_to_python(log_extra: dict = None):
return inner
def log_exceptions(func):
def log_exceptions():
""" Decorator that logs all exceptions that the function raises. """
@wraps(func)
def inner(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
except Exception as e:
self.error_stream("Caught exception: %s: %s", e.__class__.__name__, e, exc_info=1)
raise e
def wrapper(func):
@wraps(func)
def inner(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
except Exception as e:
self.error_stream("Caught exception: %s: %s", e.__class__.__name__, e, exc_info=1)
raise e
return inner
return inner
return wrapper
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