Processing Errors from Direct Mode and Shell

Executing in Direct Mode

Executing from the Shell (mumps -run ^routine)

Usage

Suitable for development and debugging.

Suitable for production.

Error Handler

Not invoked for code entered at the direct mode prompt; Note that XECUTE code is treated as not entered at the direct mode prompt

The default $ZTRAP="B" brings a process to the Direct Mode for debugging.

Errors are suppressed and cause a silent process exit. Set the environment variable gtm_etrap which overrides the default $ZTRAP="B".

If needed, error handlers can include appropriate error notification to $PRINCIPAL. For example, the gtmprofile script sets a default $ETRAP value of "Write:(0=$STACK) ""Error occurred: "",$ZStatus,!" which you can customize to suit your needs.

stderr

GT.M processes send error messages to stderr only under the following conditions:

  • The error is fatal which means that the process is about to terminate

  • During compilation except of indirection or XECUTE

  • The process is about to enter direct mode due to a BREAK command

  • The erroneous code was entered at the direct mode prompt

  • The message is informational, and intended for the user, which is unusual

For more information, see Chapter 13: “Error Processing.