The section describes (rnrs conditions (6))
library for creating and
inspecting condition types and values. A condition value encapsulates information
about an exceptional situation.
[R6RS] The condition
procedure returns a condition object with the
components of the conditions as its components, in the same order. The
returned condition is compound if the total number of components is zero or
greater than one. Otherwise, it may be compound or simple.
[R6RS] The simple-conditions
procedure returns a list of the
components of condition, in the same order as they appeared in the
construction of condition.
[R6RS] Returns #t if obj is a (simple or compound) condition, otherwise returns #f.
[R6RS] Rtd must be a record-type descriptor of a subtype of
&condition
. The condition-predicate
procedure returns a procedure
that takes one argument. This procedure returns #t if its argument is a condition
of the condition type represented by rtd, i.e., if it is either a simple
condition of that record type (or one of its subtypes) or a compound conditition
with such a simple condition as one of its components, and #f otherwise.
[R6RS] Rtd must be a record-type descriptor of a subtype of
&condition
. Proc should accept one argument, a record of the
record type of rtd. The condition-accessor
procedure returns a
procedure that accepts a single argument, which must be a condition of the type
represented by rtd. This procedure extracts the first component of the
condition of the type represented by rtd, and returns the result of
applying proc to that component.
[R6RS] Condition-type, supertypes, constructor, and predicate must all be identifiers. Each field-spec must be of the form
(_field_ _accessor_)
where both field and accessor must be identifiers.
The define-condition-type
form expands into a record-type definition for
a record type condition-type. The record type will be non-opaque, non-sealed,
and its fields will be immutable. It will have supertype has its parent type.
The remaining identifiers will be bound as follows:
Constructor is bound to a default constructor for the type : It accepts one argument for each of the record type's complete set of fields (including parent types, with the fields of the parent coming before those of the extension in the arguments) and returns a condition object initialized to those arguments.
Predicate is bound to a predicate that identifies conditions of type condition-type or any of its subtypes.
Each accessor is bound to a procedure that extracts the corresponding field from a condition of type condition-type.
Hierarchy of standard condition types:
+ &condition
+ &warning
+ &serious
+ &error
+ &violation
+ &assertion
+ &non-continuable
+ &implementation-restriction
+ &lexical
+ &syntax
+ &undefined
+ &message
+ &irritants
[R6RS] It carries a message further describing the nature of the condition to humans.
[R6RS] This type describes conditions that do not, in principle, prohibit immediate continued execution of the program, but may interfere with the program's execution later.
[R6RS] This type describes conditions serious enough that they cannot safely be ignored. This condition type is primarily intended as a supertype of other condition types.
[R6RS] This type describes errors, typically caused by something that has gone wrong in the interaction of the program with the external world or the user.
[R6RS] This type describes violations of the language standard or a library standard, typically caused by a programming error.
[R6RS] This type describes an invalid call to a procedure, either passing an invalid number of arguments, or passing an argument of the wrong type.
[R6RS] Irritants should be a list of objects. This condition provides
additional information about a condition, typically the argument list of a
procedure that detected an exception. Conditions of this type are created by the
error
and assertion-violation
procedures.
[R6RS] Who should be a symbol or string identifying the entity
reporting the exception. Conditions of this type are created by the error
and assertion-violation
procedures, and the syntax-violation
procedure.
[R6RS] This type indicates that an exception handler invoked via raise has returned.
[R6RS] This type describes a violation of an implementation restriction allowed by the specification, such as the absence of representations for NaNs and infinities.
[R6RS] This type describes syntax violations at the level of the datum syntax.
[R6RS] This type describes syntax violations. Form should be the erroneous syntax object or a datum representing the code of the erroneous form. Subform should be an optional syntax object or datum within the erroneous form that more precisely locates the violation. It can be #f to indicate the absence of more precise information.
[R6RS] This type describes unbound identifiers in the program.