Example 4: Access to "cause of error"

With $ZTRAP: If $ZSTATUS[...

With $ETRAP: If $ECODE[...

[Note]

The value of $ZSTATUS reflects only the most recent error, while the value of $ECODE is the cumulative list of all errors since its value was explicitly set to empty. Both values are always maintained and can be used with either mechanism.