[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

17. Error Processing

FreeM exposes three means of processing M program execution errors:

FreeM-style error processing

FreeM-style error processing exposes a read/write error trap in $ZTRAP. The contents of $ZTRAP must be either empty or a valid M entryref, to which FreeM will GOTO if an error occurs. Each program stack execution level can have its own $ZTRAP error handler enabled.

DSM 2.0-style error processing

DSM 2.0-style error processing emulates the $ZTRAP behavior of Digital Standard MUMPS v2. It has the same behavior as FreeM-style error handling, with the exception that in DSM 2.0-style error processing, only one $ZTRAP error handler is set across all program stack execution levels.

Standard error processing

Standard error processing uses the NEW-able $ETRAP variable to store error handler code, which may be any valid M code. The code in $ETRAP will run when an error occurs or the $ECODE ISV becomes non-empty. Stack information for standard error handling is provided by the $STACK ISV, the $STACK() intrinsic pseudo-function, and the NEW-able $ESTACK ISV.

If $ETRAP is non-empty when an error condition occurs, $ZTRAP is ignored, regardless of whether FreeM-style or DSM 2.0-style error processing is enabled at the time of the error.

For further information on switching between FreeM-style and DSM 2.0-style $ZTRAP error handling, see the documentation for the BREAK command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on October 14, 2020 using texi2html 1.82.