*error*

AutoCad AutoLISP Functions

 
*error*
 
 
 

A user-definable error-handling function

(*error* string) 

If *error* is not nil, it is executed as a function whenever an AutoLISP error condition exists. AutoCAD passes one argument to *error*, which is a string containing a description of the error.

Your *error* function can include calls to the command function without arguments (for example, (command)). This will cancel a previous AutoCAD command called with the command function.

Return Values

This function does not return, except when using vl-exit-with-value.

Examples

The following function does the same thing that the AutoLISP standard error handler does. It prints the word “error,” followed by a description:

(defun *error* (msg)
  (princ "error: ")
  (princ msg)
  (princ)
)