The (rnrs condition (6))
library provides forms and procedures
for constructing new condition types, as well as a library of
pre-defined condition types that represent a variety of common
exceptional situations. Conditions are records of a subtype of the
&condition
record type, which is neither sealed nor opaque.
See R6RS Records.
Conditions may be manipulated singly, as simple conditions, or
when composed with other conditions to form compound conditions.
Compound conditions do not “nest”—constructing a new compound
condition out of existing compound conditions will “flatten” them
into their component simple conditions. For example, making a new
condition out of a &message
condition and a compound condition
that contains an &assertion
condition and another &message
condition will produce a compound condition that contains two
&message
conditions and one &assertion
condition.
The record type predicates and field accessors described below can
operate on either simple or compound conditions. In the latter case,
the predicate returns #t
if the compound condition contains a
component simple condition of the appropriate type; the field accessors
return the requisite fields from the first component simple condition
found to be of the appropriate type.
Guile’s R6RS layer uses core exception types from the (ice-9
exceptions)
module as the basis for its R6RS condition system. Guile
prefers to use the term “exception object” and “exception type”
rather than “condition” or “condition type”, but that’s just a
naming difference. Guile also has different names for the types in the
condition hierarchy. See Exception Objects, for full details.
This library is quite similar to the SRFI-35 conditions module
(see SRFI-35 - Conditions). Among other minor differences, the (rnrs
conditions)
library features slightly different semantics around
condition field accessors, and comes with a larger number of pre-defined
condition types. The two APIs are compatible; the condition?
predicate from one API will return #t
when applied to a condition
object created in the other. of the condition types are the same,
also.
The base record type for conditions. Known as &exception
in core
Guile.
The condition
procedure creates a new compound condition out of
its condition arguments, flattening any specified compound conditions
into their component simple conditions as described above.
simple-conditions
returns a list of the component simple
conditions of the compound condition condition
, in the order in
which they were specified at construction time.
These procedures return condition predicate and accessor procedures for the specified condition record type rtd.
Evaluates to a new record type definition for a condition type with the name condition-type that has the condition type supertype as its parent. A default constructor, which binds its arguments to the fields of this type and its parent types, will be bound to the identifier constructor; a condition predicate will be bound to predicate. The fields of the new type, which are immutable, are specified by the field-specs, each of which must be of the form:
(field accessor)
where field gives the name of the field and accessor gives the name for a binding to an accessor procedure created for this field.
A type that includes a message describing the condition that occurred.
A base type for representing non-fatal conditions during execution.
A base type for conditions representing errors serious enough that
cannot be ignored. Known as &error
in core Guile.
A base type for conditions representing errors. Known as
&external-error
in core Guile.
A subtype of &serious
that can be used to represent violations of
a language or library standard. Known as &programming-error
in
core Guile.
A subtype of &violation
that indicates an invalid call to a
procedure. Known as &assertion-failure
in core Guile.
A base type used for storing information about the causes of another condition in a compound condition.
A base type used for storing the identity, a string or symbol, of the entity responsible for another condition in a compound condition.
A subtype of &violation
used to indicate that an exception
handler invoked by raise
has returned locally.
A subtype of &violation
used to indicate a violation of an
implementation restriction.
A subtype of &violation
used to indicate a syntax violation at
the level of the datum syntax.
A subtype of &violation
that indicates a syntax violation. The
form and subform fields, which must be datum values,
indicate the syntactic form responsible for the condition.