resetting current-exception-handler after handler is done

This commit is contained in:
Alex Shinn 2009-12-27 00:28:20 +09:00
parent 2534e81d5b
commit 23411056c2

View file

@ -311,11 +311,13 @@
(raise (make-exception 'user msg args #f #f)))
(define (with-exception-handler handler thunk)
(let ((orig-handler (current-exception-handler)))
(current-exception-handler
(lambda (exn)
(letrec ((orig-handler (current-exception-handler))
(self (lambda (exn)
(current-exception-handler orig-handler)
(handler exn)))
(let ((res (handler exn)))
(current-exception-handler self)
res))))
(current-exception-handler self)
(let ((res (thunk)))
(current-exception-handler orig-handler)
res)))