ON ERROR

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
ON ERROR ABORT
ON ERROR IGNORE
ON ERROR SKIP [nn]
ON ERROR CLEAR

Description:

This controls the action taken if an error occurs while running a program and applies to all errors discovered by MMBasic including syntax errors, wrong data, missing hardware, SD Card access, etc.

ON ERROR ABORT will cause MMBasic to display an error message, abort the program and return to the command prompt. 
This is the normal behaviour and is the default when a program starts running.

ON ERROR IGNORE will cause any error to be ignored.
ON ERROR IGNORE can make it very difficult to debug a program so it is strongly recommended that only ON ERROR SKIP be used.

ON ERROR SKIP will ignore an error in a number of commands (specified by the number 'nn') executed following this command. 'nn' is optional, the default if not specified is one. 
After the number of commands has completed (with an error or not) the behaviour of MMBasic will revert to ON ERROR ABORT.

If an error occurs and is ignored/skipped the read only variable MM.ERRNO will be set to non zero and MM.ERRMSG$ will be set to the error message that would normally be generated. 
These are reset to zero and an empty string by ON ERROR CLEAR. They are also cleared when the program is run and when ON ERROR IGNORE and ON ERROR SKIP are used.


Last edited: 30 September, 2020