[plt-scheme] Catch all exceptions
On Aug 30, Dmitriy.Zavin at infineon.com wrote:
> I was wondering, is there a catch-all type mechanism in mzscheme to
> catch all exceptions?
>
> I want something like
> (with-handlers ([any-exn? (lambda (exn) (write "foo"))])
> (my-proc))
>
> Is something like tha doable?
Yes -- use the above with
(define (any-exn? exn) #t)
A common idiom is to use `void' instead -- it is a function that
always returns the void value, which is not #f so it is true.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!