[plt-scheme] exception handling
Hi all,
A quick question about exception handling. I'd like to run a thunk in a
context where I can capture the error and do something with it in code -
i.e. keep the program running after the error has occurred. For example
something like this:
(define error-happened #f)
(define (err n)
(set! error-happened #t))
(call-with-exception-handler err (lambda () (modulo 0 1 2)))
(when error-happened
(do-something))
However, the value of (err) is passed to the uncaught exception handler,
which in turn stops evaluation. I certainly don't want to turn off the
normal exception handling globally, so I'm guessing I can use
(with-handlers) but I'm not sure how.
cheers,
dave