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

Log the exceptions thrown by the entry-point commands, and go to Fault if an...

Log the exceptions thrown by the entry-point commands, and go to Fault if an exception is thrown in them (unless we go to Off or Fault)
parent c24e2f9c
No related branches found
No related tags found
1 merge request!16Generic code cleanup
...@@ -22,7 +22,7 @@ from util.lofar_logging import log_exceptions ...@@ -22,7 +22,7 @@ from util.lofar_logging import log_exceptions
__all__ = ["hardware_device"] __all__ = ["hardware_device"]
from util.wrappers import only_in_states from util.wrappers import only_in_states, fault_on_error
class hardware_device(Device): class hardware_device(Device):
...@@ -76,6 +76,8 @@ class hardware_device(Device): ...@@ -76,6 +76,8 @@ class hardware_device(Device):
@command() @command()
@only_in_states([DevState.FAULT, DevState.OFF]) @only_in_states([DevState.FAULT, DevState.OFF])
@DebugIt() @DebugIt()
@fault_on_error
@log_exceptions()
def Initialise(self): def Initialise(self):
""" """
Command to ask for initialisation of this device. Can only be called in FAULT or OFF state. Command to ask for initialisation of this device. Can only be called in FAULT or OFF state.
...@@ -102,6 +104,8 @@ class hardware_device(Device): ...@@ -102,6 +104,8 @@ class hardware_device(Device):
@command() @command()
@only_in_states([DevState.STANDBY]) @only_in_states([DevState.STANDBY])
@DebugIt() @DebugIt()
@fault_on_error
@log_exceptions()
def On(self): def On(self):
""" """
Command to ask for initialisation of this device. Can only be called in FAULT or OFF state. Command to ask for initialisation of this device. Can only be called in FAULT or OFF state.
...@@ -113,6 +117,7 @@ class hardware_device(Device): ...@@ -113,6 +117,7 @@ class hardware_device(Device):
@command() @command()
@DebugIt() @DebugIt()
@log_exceptions()
def Off(self): def Off(self):
""" """
Command to ask for shutdown of this device. Command to ask for shutdown of this device.
...@@ -134,6 +139,7 @@ class hardware_device(Device): ...@@ -134,6 +139,7 @@ class hardware_device(Device):
@command() @command()
@only_in_states([DevState.ON, DevState.INIT, DevState.STANDBY]) @only_in_states([DevState.ON, DevState.INIT, DevState.STANDBY])
@DebugIt() @DebugIt()
@log_exceptions()
def Fault(self): def Fault(self):
""" """
FAULT state is used to indicate our connection with the OPC-UA server is down. FAULT state is used to indicate our connection with the OPC-UA server is down.
......
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