12.3 Basic Error Handlers

(errset U:form *EMSGP:boolean): any macro
Errset and errorset are the basic PSL error handler functions.

If an error occurs during the evaluation of U, the value of number from the associated error call is returned as the value of the errset. There are actually a couple of exceptions. If a continuable error is continued by the user in the interactive break loop, no special return to errset is done. Also if the user requests the computation to be aborted completely back to the top level no return to errset is done.

The boolean argument is evaluated without protection of the error handler. The fluid variable *EMSGP is bound to the boolean value for the evaluation of the form. If the value of *EMSGP is nil when an error occurs no error message is printed and no interactive break loop occurs. In this case control must return to the innermost error handler except for the case of a fatal error.

If errset is returned to in the normal way, its value is a list of one element, the value of the form. If errset is returned to via the error mechanism, its value is the error number of the error call that caused the return.

(errorset U:any *EMSGP:boolean *BACKTRACE:boolean): any expr
This is an older function than errset. Errset is generally preferred.

In most respects errorset behaves the same as errset. See the documentation of errset above. Note that errorset is an expr, so U gets evaluated once as the parameter is passed and the result is then evaluated inside errorset. Since errorset itself calls eval on its first argument there are likely to be problems with compiled code that uses errorset.

In addition to binding *EMSGP as errset does, errorset overrides the behavior usually specified by the *BACKTRACE switch. The backtrace behavior of PSL errors during the execution of a form inside an errorset error handler is determined by the second parameter to the errorset.

The following two switches and one global variable are used by the functions in this section. Useage of any of these can be considered advanced.

*emsgp = [Initially: t] fluid
Fluid variable rebound by errset and errorset. Controls error message printing during call on error. If nil, no error message will be printed and no interactive break loop will be entered. If an unwind backtrace has been requested through the backtrace flag or a call on errorset, one will be.

emsg* = [Initially: nil] global
Contains the message generated by the last error call. Particularly useful in case printing of the message was suppressed.

*backtrace = [Initially: nil] switch
Used by the top level read-eval-print loop to control whether an unwind backtrace will be printed when errors occur outside the scope of any user-specified error handler.