By default,
WHENEVER ANY ERROR action is to
CONTINUE the
program flow. You can force the runtime system to execute the
action defined with
WHENEVER ERROR exception
class with the following
FGLPROFILE
entry:
fglrun.mapAnyErrorToError = true
When this entry is set to true,
ET_EXPRESSION expression
errors such as a division by zero will be trapped and execute
the action defined by the last
WHENEVER ERROR instruction,
the default being
STOP the program with error
display.
-- FGLPROFILE env var is defined to file with:
-- fglrun.mapAnyErrorToError = true
MAIN
DEFINE x INT
WHENEVER ERROR CALL my_error_handler
LET x = 1 / 0 -- error handler will be called here
DISPLAY "It continues...."
END MAIN
FUNCTION my_error_handler()
DISPLAY "Handler: ", STATUS
END FUNCTION