Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

errset

errset

type: special form (fsubr)
location: built-in
source file: xlcont.c
Common LISP compatible: no
supported on: all machines

SYNTAX

(errset  <expr> [ <print-flag> ]  )
        <expr>          -       an expression to be evaluated
        <print-flag>    -       an optional expression ( NIL or non-NIL )

DESCRIPTION

The ERRSET special form is a mechanism that allows the trapping of errors within the execution of <expr>. *BREAKENABLE* must be set to NIL for the ERRSET form to function. If *BREAKENABLE* is non-NIL, the normal break loop will handle the error. For ERRSET, if no error occurs within <expr>, the value of the last expression is CONSed with NIL. If an error occurs within <expr>, the error is caught by ERRSET and a NIL is returned from ERRSET. If <print-flag> is NIL, the error message normally generated by <expr> will not be printed. If <print-flag> is non-NIL or not present in the ERRSET form, the error message will be printed.

Errors from ERROR and CERROR and system errors will be handled by ERRSET. Note that the CERROR message will only include the error message portion, not the continue message portion. BREAK is not intercepted by ERRSET.

EXAMPLES

(nodebug)                               ; sets *BREAKENABLE* to NIL
(errset (error "hi" "ho"))              ; prints  error: hi - "ho"
                                        ; returns NIL
(errset (cerror "hi" "ho" "he"))        ; prints  error: ho - "he"
                                        ; returns NIL
(errset (error "hey" "ho") NIL)         ; returns NIL
(errset (break "hey"))                  ; break: hey
(errset (+ 1 5) )                       ; returns (6)
(errset (+ 1 "a") NIL )                 ; returns NIL
(debug)                                 ; re-enable break-loop on errors

NOTE: Be sure to set *BREAKENABLE* to NIL before using ERRSET and to non-NIL after using ERRSET. If you don't reset *BREAKENABLE*, no errors will be reported.


Go to the first, previous, next, last section, table of contents.