Difference between revisions of "ERROR"
From ICE Enterprises
ConvertBot (talk | contribs) (causes a macro to terminate with an error) |
(No difference)
|
Latest revision as of 17:04, 27 April 2020
causes a macro to terminate with an error
<text> - message to print to screen when the error occurs
The ERROR command is the macro equivalent of the M.error() function that
a primitive would use. Its primary function is to signal an error to the
calling macro. The command simply throws a MidasException with the given
message. If the macro has PROCESSEXCEPTION procedure, it can handle the
exceptions on a case by case basis. If not, a message is generated, and
the macro continues to execute.
Examples:
This example shows how a calling macro can use the TRAP command to trap an
error generated by ERROR. In this case, MYMACRO wants to call FIXIT if the
macro DANGEROUS has an error:
-- MYMACRO.M --
mymacro a:file
TRAP error handler
say "Going to call %DANGEROUS."
%dangerous file
TRAP error off
say "%DANGEROUS executed OK."
STOP
endmacro
procedure handler m:msg
say "%DANGEROUS had the problem ^msg.data"
return
procedure processException m:msg
say "The file had better have some data elements in it."
return
-- END MYMACRO.M --
Switches:
None
See Also: PAUSE, TRAP