condition(3scm) Scheme Programmer's Manual condition(3scm)

condition - compound conditions

(import (rnrs))                     ;R6RS
(import (rnrs conditions))          ;R6RS

(condition condition1 ...)

Returns a condition object with the components of the conditions as its components, in the same order, i.e., with the components of condition1 appearing first in the same order as in condition1, then with the components of condition2, and so on.

Compound conditions act as if they were any of the included simple conditions with regard to predicates and accessors.

Returns a single value; a condition. The returned condition is compound if the total number of components is zero or greater than one. Otherwise, it may be compound or simple.

(define con
  (condition
   (make-error)
   (make-message-condition "I am an error")))
(error? con)  =>  #t
(message-condition? con)  =>  #t
(condition-message con)  =>  "I am an error"

Compound conditions are used when describing multiple aspects of exceptional situations. They are passed to raise(3scm) and raise-continuable(3scm). They are normally caught with guard(3scm).

Compound conditions are unique to R6RS.

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.

simple-conditions(3scm)

R6RS

This procedure was first introduced in R6RS as part of the new condition system.

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2022-05-14