Improve error handling in DAQInterface
Right now, under certain error conditions, DAQInterface will shut down, but a thread of execution will continue at the same time as the shutting-down procedure, creating excessive output and making it more difficult to find the error message. Worse, even if all the artdaq processes have been killed, DAQInterface can think that it isn't in fact in the stopped state, and will refuse to take transitions you should be able to pass to it when it's in stopped (i.e., the boot transition). The following goals should be met for the way DAQInterface handles error conditions:
-If the error occurs in a function directly called externally (e.g., a transition function), it should either try to print a warning and restore the state to before the function call, or print an error message and put itself into the stopped state.
-If the error occurs in a function called by another DAQInterface function, that error should be handled by an exception throw, rather than directly causing a shutdown. It's because of this that the phenomenon above can occur i.e., the called function requests that DAQInterface shuts down into the stopped state and returns, but the callee is unaware there was a problem and continues execution.
#1 Updated by John Freeman almost 4 years ago
- % Done changed from 0 to 100
While it's always possible to make improvements (https://en.wikipedia.org/wiki/Kaizen) with commit 32cc52fbf0a9dd537f615816df75bde581527a80 of artdaq-utilities-daqinterface, most of the needs for improved error handling as described above have been satisfied: where possible, exceptions will no longer escape the user-called transition functions but will either be handled internally, resulting in a reversion to the previous state before the failed transition was requested, or will result in DAQInterface shutting itself down into the "stopped" state.