The (rnrs exceptions (6))
library provides functionality related
to signaling and handling exceptional situations. This functionality
re-exports Guile’s core exception-handling primitives.
See Exceptions, for a full discussion. See SRFI-34 - Exception handling for programs, for a similar
pre-R6RS facility. In Guile, SRFI-34, SRFI-35, and R6RS exception
handling are all built on the same core facilities, and so are
interoperable.
See Raising and Handling Exceptions, for more information on
with-exception-handler
.
Evaluates the expression given by body, first creating an ad hoc
exception handler that binds a raised exception to variable and
then evaluates the specified clauses as if they were part of a
cond
expression, with the value of the first matching clause
becoming the value of the guard
expression
(see Simple Conditional Evaluation). If none of the clause’s test expressions
evaluates to #t
, the exception is re-raised, with the exception
handler that was current before the evaluation of the guard
form.
For example, the expression
(guard (ex ((eq? ex 'foo) 'bar) ((eq? ex 'bar) 'baz)) (raise 'bar))
evaluates to baz
.
Equivalent to core Guile (raise-exception obj)
.
See Raising and Handling Exceptions. (Unfortunately, raise
is already bound to a different function in core Guile.
See Signals.)
Equivalent to core Guile (raise-exception obj #:continuable?
#t)
. See Raising and Handling Exceptions.