Exceptions

Library (rnrs exceptions (6))

This section describes exception-handling and exception-raising constructs provided by the (rnrs exceptions (6))library.

Function with-exception-handler handler thunk

[R6RS] Handler must be a procedure and should accept one argument. Thunk must be a procedure that accepts zero arguments. The with-exception-handler procedure returns the results of invoking thunk. When an exception is raised, handler will be invoked with the exception.

Macro guard (variable cond-clause ... ) body

[R6RS] Each cond-clause is as in the specification of cond. and else are the same as in the (rnrs base (6)) library.

Evaluating a guard form evaluates body with an exception handler that binds the raised object to variable and within the scope of that binding evaluates the clauses as if they were the clauses of a condexpression. If every cond-clause's test evaluates to #f and there is no else clause, then raise is re-invoked on the raised object.

Function raise obj

[R6RS] Raises a non-continuable exception by invoking the current exception handler on obj.

Function raise-continuable obj

[R6RS] Raises a continuable exception by invoking the current exception handler on obj.