Error Actions

Break on an Error
Unconditional Transfer on an Error
Setting $ZTRAP for Each Level
Nested Error Handling
Terminating Execution on an Error
Setting $ZTRAP to Other Actions
Summary of $ETRAP & $ZTRAP Error-Handling Options
Errors in $ZTRAP
Recording Information about Errors

In the following examples (and the previous one as well), $ETRAP and $ZTRAP in most cases have similar behavior. The most prominent difference is that, when $ETRAP is active, $ECODE determines whether or not a second error in an M stack level triggers an immediate implicit QUIT from that level. For additional information, refer to the sections on $ECODE and $ETRAP in the Intrinsic Special Variable chapter. Because of the effect of $ECODE on the processing flow when $ETRAP is active, there is a benefit to including appropriate $ECODE maintenance in $ZTRAP related code, so that things stay well behaved when the two mechanisms are intemixed. Other differences are discussed in some of the examples.