Setting the ONERROR Behavior
- Last UpdatedOct 25, 2022
- 1 minute read
The default setting is:
onerror RETURN
This causes the current macro or function to be abandoned and gives the calling macro or function an opportunity to handle the error.
Another possibility is to jump to one section of code in the same macro or function after any unhandled error:
onerror GOLABEL /LabelName
$* The first command to be executed after the label
$* must be a handle command - it could for example be a handle ANY command:
label /LabelName
handle ANY
$* handle block
endhandle
To suppress errors, and error alerts, the following may be used, for example during non-interactive testing:
onerror CONTINUE
Although the effect of errors is suppressed, any error messages generated will still be output. Beware of using this option which can have unpredictable effects. The option is applied to all subsequently nested PML macro and function calls.
When debugging, you may interrupt normal PML processing after an error:
onerror PAUSE
The effect is the same as $M- and will allow you to type commands while the PML file is suspended. You must type $M+ to resume the PML processing.
Note:
Do not leave this in working code.