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.
This library is quite similar to the SRFI-35 conditions module
(see SRFI-35). 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 not currently compatible,
however; the condition? predicate from one API will return
#f when applied to a condition object created in the other.
The base record type for conditions.
The
conditionprocedure creates a new compound condition out of its condition arguments, flattening any specified compound conditions into their component simple conditions as described above.
simple-conditionsreturns a list of the component simple conditions of the compound conditioncondition, 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.
A base type for conditions representing errors.
A subtype of
&seriousthat can be used to represent violations of a language or library standard.
A subtype of
&violationthat indicates an invalid call to a procedure.
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
&violationused to indicate that an exception handler invoked byraisehas returned locally.
A subtype of
&violationused to indicate a violation of an implementation restriction.
A subtype of
&violationused to indicate a syntax violation at the level of the datum syntax.
A subtype of
&violationthat indicates a syntax violation. The form and subform fields, which must be datum values, indicate the syntactic form responsible for the condition.