previous up next     contents index
Next: Continuations Up: MzScheme Architecture Previous: Library Functions

Exceptions and Escaping Continuations

  When MzScheme encounters an error, it raises an exception. The default exception handler invokes the error display handler and then the error escape handler. The default error escape handler escapes by calling scheme_longjmp(scheme_error_buf). An embedding program must call scheme_setjmp(scheme_error_buf) before any top-level entry into MzScheme evaluation (except for  scheme_rep, which catches and ignores all errors).

New primitive procedures and syntax can raise a generic exception by calling  scheme_signal_error. The parameters for  scheme_signal_error are the same as for the standard C function  printf. A specific primitive exception can be raised by calling  scheme_raise_exn.

  The invocation of an escaping continuation looks like an error escape, but the flag  scheme_jumping_to_continuation will be set to 1 instead of 0; this situation is only visible when implementing a new primitive procedure or syntax. In general, honor the escape request by chaining to the next exception handler.





PLT