condition-utils

SRFI 12 Condition Utilities

  1. condition-utils
  2. Documentation
    1. Argument Conventions
    2. make-exn-condition
    3. make-exn-condition+
    4. make-condition+
    5. condition-predicate*
    6. make-condition-predicate
    7. condition-property-accessor*
    8. make-condition-property-accessor
    9. condition-irritants
  3. Usage
  4. Author
  5. Version history
  6. License

Documentation

Convenience API for constructing common Chicken exception conditions, predicates, and accessors.

Argument Conventions

LOC is a symbol, or #f.

MSG is a string, or #f.

ARGS is a list, or #f.

CHN is the result of (get-call-chain), or #f.

COND is a:

property-condition
literal
symbol
(make-property-condition <symbol>)
list
(apply make-property-condition <list>)

KIND is a symbol.

PROP is a symbol.

make-exn-condition

[procedure] (make-exn-condition [LOC [MSG [ARGS [CHN]]]]) => property-condition

Returns an exn property-condition with optional location, arguments, and call-chain property values.

Defaults:

LOC
missing
MSG
"unknown"
ARGS
missing
CHN
missing

Will always include message property in the property-condition.

make-exn-condition+

[procedure] (make-exn-condition+ LOC MSG ARGS [CHN] [COND...]) => property-condition

Returns a composite-condition exn COND....

When one-of LOC, MSG, or ARGS is without a useful value in the error context use #f as the actual argument. The optional CHN argument is detected by structure.

When MSG is #f the value "unknown" is used.

make-condition+

[procedure] (make-condition+ COND...) => property-condition

Returns a composite-condition COND....

condition-predicate*

[procedure] (condition-predicate* KIND) => (procedure (*) boolean)

Returns a "memoized" condition-predicate for KIND.

make-condition-predicate

[syntax] (make-condition-predicate KIND...) => (procedure (*) boolean)

Returns a condition-predicate for KIND....

condition-property-accessor*

[procedure] (condition-property-accessor* KIND PROP [DEFAULT]) => (procedure (*) boolean)

Returns a "memoized" condition-property-accessor for KIND.

make-condition-property-accessor

[syntax] (make-condition-property-accessor KIND PROP [DEFAULT]) => (procedure (*) boolean)

Returns a condition-property-accessor for KIND PROP.

condition-irritants

[procedure] (condition-irritants EXN) => list

Returns a property list of the condition properties for the condition EXN. The properties are without associated condition information.

Usage

(require-extension condition-utils)

Author

Kon Lovett

Version history

1.0.4
default exn msg
1.0.3
added call-chain argument & standard conditions
1.0.2
Fix for ticket #630
1.0.1
1.0.0
Hello (from "check-errors:1.11.0")

License

Copyright (C) 2009-2014 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.