### 16.6 Condition Types ¶

Each condition has a condition type object associated with it. These objects are used as a means of focusing on related classes of conditions, first by concentrating all of the information about a specific class of condition in a single place, and second by specifying an inheritance relationship between types. This inheritance relationship forms the taxonomic structure of the condition hierarchy (see Condition-Type Taxonomy).

The following procedures consititute the abstraction for condition types.

procedure: make-condition-type name generalization field-names reporter ¶

  Creates and returns a (new) condition type that is a specialization of generalization (if it is a condition type) or is the root of a new tree of condition types (if generalization is `#f`). For debugging purposes, the condition type has a name, and instances of this type contain storage for the fields specified by field-names (a list of symbols) in addition to the fields common to all conditions (type, continuation and restarts).

  Reporter is used to produce a description of a particular condition of this type. It may be a string describing the condition, a procedure of arity two (the first argument will be a condition of this type and the second a port) that will `write` the message to the given port, or `#f` to specify that the reporter should be taken from the condition type generalization (or produce an “undocumented condition of type …” message if generalization is `#f`). The conventions used to form descriptions are spelled out in Error Messages.

procedure: condition-type/error? condition-type ¶

  Returns `#t` if the condition-type is `condition-type:error` or a specialization of it, `#f` otherwise.

procedure: condition-type/field-names condition-type ¶

  Returns a list of all of the field names for a condition of type condition-type. This is the set union of the fields specified when this condition-type was created with the `condition-type/field-names` of the generalization of this condition-type.

procedure: condition-type/generalizations condition-type ¶

  Returns a list of all of the generalizations of condition-type. Notice that every condition type is considered a generalization of itself.

procedure: condition-type? object ¶

  Returns `#f` if and only if object is not a condition type.