mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
resetting current-exception-handler after handler is done
This commit is contained in:
parent
2534e81d5b
commit
23411056c2
1 changed files with 7 additions and 5 deletions
12
lib/init.scm
12
lib/init.scm
|
@ -311,11 +311,13 @@
|
||||||
(raise (make-exception 'user msg args #f #f)))
|
(raise (make-exception 'user msg args #f #f)))
|
||||||
|
|
||||||
(define (with-exception-handler handler thunk)
|
(define (with-exception-handler handler thunk)
|
||||||
(let ((orig-handler (current-exception-handler)))
|
(letrec ((orig-handler (current-exception-handler))
|
||||||
(current-exception-handler
|
(self (lambda (exn)
|
||||||
(lambda (exn)
|
(current-exception-handler orig-handler)
|
||||||
(current-exception-handler orig-handler)
|
(let ((res (handler exn)))
|
||||||
(handler exn)))
|
(current-exception-handler self)
|
||||||
|
res))))
|
||||||
|
(current-exception-handler self)
|
||||||
(let ((res (thunk)))
|
(let ((res (thunk)))
|
||||||
(current-exception-handler orig-handler)
|
(current-exception-handler orig-handler)
|
||||||
res)))
|
res)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue