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.

cerror

cerror

type: function (subr) 
location: built-in
source file: xlbfun.c  and  xldbug.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(cerror  <cont-msg> <err-msg>  [ <arg> ] )
        <cont-msg>      -       a string expression for the continue message
        <err-msg>       -       a string expression for the error message
        <arg>           -       an optional expression 

DESCRIPTION

The CERROR function allows the generation of a continuable error. A continuable error is one that can be corrected by some action within the XLISP break loop. The form of the message generated is:

error: <err-msg> - <arg>
if continued: <cont-msg>        

From within the break-loop, if a CONTINUE form is evaluated then a NIL is returned from CERROR. From within the break loop, forms can be evaluated to correct the error. If desired, the CLEAN-UP and TOP-LEVEL forms may be evaluated to abort out of the break loop.

EXAMPLES

(cerror "fee" "fi" "fo")                ; CERROR generates the message -
                                        ; error: fi - "fo"
                                        ; if continued: fee
(cerror "I will do better"              ; CERROR generates the message -
        "There's a problem, Dave")      ;
                                        ; error: There's a problem, Dave
                                        ; if continued: I will do better
                                        ; example of system generated
                                        ; correctable error -
(symbol-value 'f)                       ; error: unbound variable - F
                                        ; if continued: 
                                        ;   try evaluating symbol again

COMMON LISP COMPATIBILITY: Common LISP and XLISP have the same basic form and style for CERROR. However, the <err-msg> and <cont-msg> string in Common LISP is sent to FORMAT. FORMAT is a output function that takes in format strings that include control information. Although, XLISP does have the FORMAT function, it does not print the CERROR <err-msg> with FORMAT. So, Porting from XLISP to Common LISP will work fine. When porting from Common LISP to XLISP, you will need to check for this embedded control information in the error messages.

NOTE: In the XLISP system, the only correctable system errors have to do with the value of a symbol being unbound. In these cases, you can do a SETQ or SET from within the break loop and then CONTINUE.

NOTE: Remember that *BREAKENABLE* needs to non-NIL for ERROR and CERROR and system errors to be caught by the normal system break loop. If *BREAKENABLE* is NIL, ERROR and CERROR and system errors can be caught by an ERRSET form. If there is no surrounding ERRSET, no error message is generated and the break loop is not entered.


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