When a runtime error occurs while a dialog is active, the dialog receives an error event. You can specify event-handler code to be executed whenever this error occurs. If no error event-handler code is specified, Natural aborts with an error message and all dialogs will be closed.
You can continue normal dialog processing after error handling by
specifying an ESCAPE
ROUTINE
statement at the end of the event-handler code.
The dialog editor
generates an ON ERROR
statement for the event handler. If, for example, you want to prevent the end
user from closing the entire application when trying to divide an integer by
zero, and the parameter ZD
is set to ON
,
the error event-handler code might look like this:
COMPRESS 'Natural error' *ERROR 'occurred.' INTO #DLG$WINDOW.STATUS-TEXT ESCAPE ROUTINE