JMRI: Error Handling Module
LogixNG error handling is configured using Preferences ⇒ LogixNG. The details are at Error Handling. The Error Handling Module makes it possible to implement custom error handling.
The module is similar to the standard LogixNG modules at Tools ⇒ Tables ⇒ LogixNG Modules. The main differences are that the error module is a system module instead of a user module and it is called when an error occurs instead of from a ConditionalNG. It is managed using Tools ⇒ LogixNG ⇒ Error handling module. The error module is not included in the LogixNG Modules table.
- Create/Edit Module
- Click on Tools ⇒ LogixNG ⇒ Error handling module. This will open the standard LogixNG editing window. Enter the logic to be performed when an error occurs. It can be as simple as Log local variables. Other ideas include putting a message in a JMRI Memory variable to be displayed on a panel, or set a sensor, or send a MQTT message. The tool's menu text is modified to include (enabled) to indicate that the module is ready to handle errors.
- Delete Module
- To delete the module, remove all of the content, leaving only an empty Root item. The tool's menu text will no longer show (enabled).
- Local Variables
- When the error module is called, seven local variables are available. See the example below. The local variables provide detail location and error information.
Log local variables: [JMRI LogixNGThread]
Name: __logixng__, Value: IQ:AUTO:0001
Name: __conditionalng__, Value: IQC:AUTO:0001
Name: __module__, Value: null
Name: __item__, Value: IQDA:AUTO:0002
Name: __exception__, Value: jmri.jmrit.logixng.SymbolTable$SymbolNotFound: Symbol 'MyTurnout' does not exist in symbol table
Name: __messageList__, Value: null
Name: __message__, Value: An exception has occurred during execute: Symbol 'MyTurnout' does not exist in symbol table
Log local variables done