previous up next     contents index
Next: Library Functions Up: Exceptions and Escaping Continuations Previous: Continuations

Temporarily Catching Errors

  When implementing new primitive functions or syntax, it is sometimes useful to catch and handle errors that occur in evaluating subexpressions. One way to do this is the following: first copy  scheme_signal_error to a temporary variable, invoke scheme_setjmp(scheme_error_buf), perform the function's work, and then restore  scheme_signal_error before returning a value. This solution works fine as long as the procedure/syntax implementation only calls top-level evaluation functions ( scheme_eval,  scheme_eval, etc., as opposed to  _scheme_eval,  _scheme_apply, etc.). Otherwise, use  scheme_dynamic_wind to temporarily catch errors.



PLT