The AutoLISP language provides several functions for error handling. You can use these functions to do the following:
AutoLISP Function Synopsis under the heading Error-Handling Functions Each error-handling function is described in the AutoLISP Reference.
The complete list of error-handling functions is ininters function requires several arguments, each of which must be either a 2D or 3D point list. A call to inters like the following:
If your program contains more than one error in the same expression, you cannot depend on the order in which AutoLISP detects the errors. For example, the(inters 'a)
is an error on two counts: too few arguments and invalid argument type. You will receive either of the following error messages:
; *** ERROR: too few arguments
; *** ERROR: bad argument type: 2D/3D point
Your program should be designed to handle either error.
Note also that in AutoCAD, AutoLISP evaluates all arguments before checking the argument types. In previous releases of AutoCAD, AutoLISP evaluated and checked the type of each argument sequentially. To see the difference, look at the following code examples:
(defun foo ()
(print "Evaluating foo")
'(1 2))
(defun bar ()
(print "Evaluating bar")
'b)
(defun baz ()
(print "Evaluating baz")
'c)
inters function is evaluated in AutoCAD:
Observe how an expression using theCommand: (inters (foo) (bar) (baz))
"Evaluating foo"
"Evaluating bar"
"Evaluating baz"
; *** ERROR: too few arguments
inters and discovered that too few arguments were specified.
Each argument was evaluated successfully before AutoLISP passed the results toIn AutoCAD Release 14 or earlier, the same expression evaluated as follows:
Command: (inters (foo) (bar) (baz))
"Evaluating foo"
"Evaluating bar" error: bad argument type
(foo), then passed the result to inters. Since the result was a valid 2D point list, AutoLISP proceeds to evaluate (bar), where it determines that the evaluated result is a string, an invalid argument type for inters.
AutoLISP evaluated