Next: iklib conditions exprindex, Previous: iklib conditions errno, Up: iklib conditions [Index]
Let’s say we need code like this:
(if (fixnum? obj) obj (raise-exception))
we might want to raise a condition object holding the failed expression
(fixnum? obj)
; for this we can use &failed-expression
as follows:
(if (fixnum? obj) obj (raise (make-assertion-violation) (make-message-condition "failed object validation") (make-failed-expression-condition '(fixnum? obj)) (make-irritants (list obj))))
Condition type used to describe a failed expression, for example in a
procedure argument validation predicate. It is derived from
&condition
. It has the following fields:
failed-expression
A symbolic expression representing the source code of the failed expression.
Build and return a condition object of type
&failed-expression
.
Return #t
if obj is a condition object of type
&failed-expression
; otherwise return #f
.
Given a condition object of type &failed-expression
return
the symbolic expression.