XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

error


Type:   -   function (subr)
Source:   -   xlbfun.c, xldbug.c

Syntax

(error err-msg [arg])
err-msg - a string expression for the error message
arg - an optional argument expression (printed after the message)
returns - never returns

Description

The 'error' function allows the generation of a non-correctable error. A non-correctable error requires evaluation of a clean-up or top-level function from within the XLISP break loop to return to normal execution. The form of the message generated is:

error: err-msg - arg

From within the break-loop, if a continue function is evaluated then a an error message is generated:

error: this error can't be continued

There is no return from the 'error' function.

Examples

(error "fee" "fi")           ; ERROR generates the message
                             ;   error: fee - "fi"

(error "can't get" "there")  ; ERROR generates the message
                             ;   error: Can't get - "there"

Common Lisp: Common Lisp and XLISP have the same basic form and style for 'error'. However, the 'err-msg' string in Common Lisp is sent to the format function. Although, XLISP does have the format function, it does not print the '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: Remember that *breakenable* needs to be 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.

See the error function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next