Permalink
Browse files

Two error handling fixes to com-eval: First, don't handle errors when

evaluating in the foreground thread, so that errors can be handled in the
SLIME debugger or similar.. Second, rebind *debugger-hook* if evaluating
in a background thread.
  • Loading branch information...
1 parent e5585da commit ed2e761f60eab97b47901267a3b9b7061f7baad5 Andy Hefner committed Nov 30, 2008
Showing with 11 additions and 7 deletions.
  1. +11 −7 Apps/Listener/dev-commands.lisp
View
18 Apps/Listener/dev-commands.lisp
@@ -1516,21 +1516,25 @@ if you are interested in fixing this."))
((form 'clim:form :prompt "form"))
(let ((standard-output *standard-output*)
(standard-input *standard-input*)
+ (debugger-hook *debugger-hook*)
(application-frame *application-frame*))
(flet ((evaluate ()
(let ((- form)
(*standard-output* standard-output)
(*standard-input* standard-input)
(*error-output* standard-output)
+ (*debugger-hook* debugger-hook)
(*application-frame* application-frame)
error success)
- (unwind-protect (handler-case (prog1 (cons :values (multiple-value-list (eval form)))
- (setf success t))
- (serious-condition (e)
- (setf error e)
- (error e)))
- (when (not success)
- (return-from evaluate (cons :error error)))))))
+ (if *use-background-eval*
+ (unwind-protect (handler-case (prog1 (cons :values (multiple-value-list (eval form)))
+ (setf success t))
+ (serious-condition (e)
+ (setf error e)
+ (error e)))
+ (when (not success)
+ (return-from evaluate (cons :error error))))
+ (cons :values (multiple-value-list (eval form)))))))
;; If possible, use a thread for evaluation, permitting us to
;; interrupt it.
(let ((start-time (get-internal-real-time)))

0 comments on commit ed2e761

Please sign in to comment.