TRAP
Jump to navigation
Jump to search
Handles trapping of errors in the macro language
<TYPE> - Type of exception = ERROR|WARNING|OFF [DEF=ERROR] <LABEL> - Name of statement label or "OFF" to disable TRAP [DEF=OFF] <QUIET> - YES to trap quietly; NO to trap noisily [DEF=NO] The above parameters are only used for .TXT macro support. NeXtMidas .MM macro traps are enabled by defining a processException procedure in your macro. Traps are ALWAYS ON in NeXtMidas. Handle macro exceptions (errors) by including a processException procedure in your macro. Example: startmacro set fileName "bad_file_name" label re_enter if filename EQS "bad_file_name" then error "The file name ^filename is a BAD file name" endif stop label try_again set newFileName "good_file_name" ask S:filename "^filename is a BAD. Enter new filename[^newfileName]: " goto re_enter endmacro procedure processException M:emsg ! say "Caught exception, name=^{emsg.name} emsg.data=^{emsg.data}" say "Caught exception, continue processing.." goto try_again return