$ET[RAP] contains a string value that GT.M invokes when an error occurs during routine execution. When a process is initiated, but before any commands are processed, the value of $ETRAP is empty string.

The value of this variable is the M[UMPS] code that gets executed when an error occurs.


The value of $ETRAP is changed with the SET command. Changing the value of $ETRAP with the SET command initiates a new trap; it does not save the old trap.

For more examples of the use of special variable $ETRAP, see the function $STACK().