(handler key args ...)
key is a symbol or #t.
thunk takes no arguments. If thunk returns normally, that
is the return value of catch
.
Handler is invoked outside the scope of its own catch
. If
handler again throws to the same key, a new handler from further
up the call chain is invoked.
If the key is #t
, then a throw to any symbol will match
this call to catch
.
key is a symbol. It will match catches of the same symbol or of #t.
If there is no handler at all, an error is signaled.
misc-error
and a message constructed by
displaying msg and writing args.
#f
. message
is the error message string, possibly containing %S
and %s
escapes. When an error is reported, these are replaced by formating the
corresponding members of args: %s
formats using display
and %S
formats using write
. data is a
list or #f
depending on key: if key is
system-error
then it should be a list
containing the Unix errno
value; If key is signal
then
it should be a list containing the Unix signal number; otherwise it
will usually be #f
.
#f
is returned instead.
It is traditional in Scheme to implement exception systems using
call-with-current-continuation
, but his has not been done, for
performance reasons. The implementation of
call-with-current-continuation
is a stack copying implementation.
This allows it to interact well with ordinary C code. Unfortunately, a
stack-copying implementation can be slow -- creating a new continuation
involves a block copy of the stack.
Instead of using call-with-current-continuation
, the exception
primitives are implemented as built-ins that take advantage of the
upward only nature of exceptions.
Go to the first, previous, next, last section, table of contents.