Handling Errors
- Last UpdatedOct 29, 2024
- 2 minute read
An error arising during the processing of a PML macro or function does not immediately give rise to an error message - this depends on the next line of input.
Provided the next command processed by PML is a matching handle command, the error is not output and the commands within the matching handleblock are processed instead.
elsehandle blocks may optionally also be present - if the handle block does not match the error one elsehandle will be processed - if it matches the error.
$* a command causes Error(46, 28)
handle (46, 27)
$* handle block - not processed this time
elsehandle (46, 28)
$* The commands in this matching handle block are processed next
elsehandle ANY
$* An ANY Handle Block is processed for any errors. I
$* n this position it would handle errors other than (46, 27) and (46, 28)
elsehandle NONE
$* A NONE Handle Block is processed only if there were no errors
endhandle
$* This line is processed after the handle block.
If (46,27) matches the error, PML processes the commands in that handle block instead of outputting an error. Processing of the current PML macro or function continues at the line after the endhandle command.
Note:
The keywords ANY and NONE which can optionally be used in place of a specific error code.
If the line following a line which has caused an error is not a handle command, the outcome depends on the current setting of onerror (see next section). The default setting is onerror RETURN and the current macro or function is abandoned.
However, if in the calling PML macro or function, the next command to be processed is a handle command, it now gets an opportunity of handling the error (and so on up the calling PML).