- condition-property-accessor kind-key prop-key #!optional defaultprocedure
Returns a procedure that can be called with any condition that satisfies (condition-predicate ''kind-key''). Given a condition that was created by make-property-condition and kind-key, the procedure returns the value that is associated with prop-key. Given a composite condition created with make-composite-condition, the procedure returns the value that is associated with prop-key in one of the components that satisfies (condition-predicate ''kind-key'').
On CHICKEN, this procedure accepts an optional third argument DEFAULT. If the condition does not have a value for the desired property and if the optional argument is given, no error is signaled and the accessor returns the third argument.
When the system raises an exception, the condition it passes to the exception handler includes the 'exn kind with the following properties:
- the error message
- the arguments passed to the exception handler
- the name of the procedure where the error occurred (if available)
Thus, if exn is a condition representing a system exception, then
((condition-property-accessor 'exn 'message) exn)
extracts the error message from exn. Example:
(handle-exceptions exn (begin (display "Went wrong: ") (display ((condition-property-accessor 'exn 'message) exn)) (newline)) (car '())) ; displays something like "Went wrong: can't take car of nil"