[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

catching errors (continued)



> I the system I am developing, I have my own top level function
> which looks something like this
> 
> (defun my-toplevel ()
>   (multiple-value-bind (result errorp)
>                        (catch-error-quietly
>                          ...body...)
>     (when errorp
>       (my-report-error result))))
>
> This works all fine except when an error is generated outside
> the ...body... (as an example from a fred command that gets
> executed while you are in the ...body...).
> 
> When that appens, the error doesnt get catched and no error
> gets reported which makes debbuging code very hard.
>
> Has anybody experienced the same problem?

Shortly after writing this message I noticed that the fact of
having a toplevel function is independant of my problem, so I
now restate it in a simpler form.

(defobfun (make-error *fred-window*) ()
  (error "An error occured."))

(def-fred-command (:control #\enter) make-error)

;; If you do a (:control #\enter) during the (read)...

;; this works fine
(catch-error
  (read))

;; but in this case no error gets reported
(catch-error-quietly
  (read))

-- 
Guillaume Cartier
cartier@math.uqam.ca
LACIM, Universite du Quebec a Montreal.