chickadee » chicken » condition » with-exception-handler

with-exception-handler handler thunkprocedure

Returns the result(s) of invoking thunk. The handler procedure is installed as the current exception handler in the dynamic context of invoking thunk.


 (lambda (k)
  (with-exception-handler (lambda (x) (k '()))
                          (lambda () (car '())))))
;=> '()

Note that the handler procedure must somehow return non-locally out of the dynamic extent of the with-exception-handler form, because returning normally will signal yet another exception and thus result in non-termination.