type: function (subr) location: built-in source file: xlbfun.c and xldbug.c Common LISP compatible: similar supported on: all machines
(error <err-msg> [ <arg> ] ) <err-msg> - a string expression for the error message <arg> - an optional expression
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.
(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 COMPATIBILITY: Common LISP and XLISP have the same basic form and style for ERROR. However, the <err-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 is not used with error messages. 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 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.