Author Topic: vl-catch-all-apply within error function  (Read 1937 times)

0 Members and 1 Guest are viewing this topic.

Joe Burke

  • Guest
vl-catch-all-apply within error function
« on: February 16, 2011, 07:24:58 AM »
While working on an updated version of SupperFlatten, I found a call to vl-catch-all-apply within an *error* function seems to behave in an unexpected manor.

IOW, if vl-catch-all-apply retruns an error, the *error* function reports an error in the *error* function at the command line.

This leads me to think use of vl-catch-all-apply within an error handler does not behave the same as use of that function elsewhere.

Any thoughts on this?
« Last Edit: February 16, 2011, 07:32:34 AM by Joe Burke »

Lee Mac

  • Seagull
  • Posts: 12927
  • London, England
Re: vl-catch-all-apply within error function
« Reply #1 on: February 16, 2011, 10:36:25 AM »
Everything seems to work as expected for me: the vl-catch-all-apply traps the error within the *error* function and the error message you describe isn't displayed.

This was my quick test code:

Code: [Select]
(defun c:test ( / *error* )

  (defun *error* ( msg )
    (print (vl-catch-all-apply 'rtos nil))
    (princ)
  )

  (rtos (getreal "\nHit Enter to Force Error: "))
  (princ)
)

(Was the first thing I could think of to force an error)

Returns (after hitting enter):

Code: [Select]
Hit Enter to Force Error:

#<%catch-all-apply-error%>

As expected.

Perhaps there is an error elsewhere in your *error* function  :?


cadabyss

  • Guest
Re: vl-catch-all-apply within error function
« Reply #2 on: February 16, 2011, 11:22:01 PM »
Not sure if this helps but sometimes an error in the *error* function can be caused by the user hitting the escape key repeatably.  The first time the escape key is hit causes the *error* function to run.  The second time the escape key is hit causes the error in the *error* function.