SRFI 12 Condition Utilities
- Bugs & Limitations
- Version history
Convenience API for constructing common Chicken exception conditions, predicates, and accessors.
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:
- (make-property-condition <symbol>)
- (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.
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....
make-condition-predicate[syntax] (make-condition-predicate KIND...) => (procedure (*) boolean)
Returns a condition-predicate for KIND....
make-condition-property-accessor[syntax] (make-condition-property-accessor KIND PROP [DEFAULT]) => (procedure (*) boolean)
Returns a condition-property-accessor for KIND PROP. The default value of DEFAULT is #f.
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.
write-exn-condition[procedure] (write-exn-condition COND)
Produces on (current-output-port) the form:
Error: (<location - if any>) <message - if any>: <arguments - if any> Call history: <call-chain>
or when call-chain unavailable:
Error: (<location - if any>) <message - if any>: <arguments - if any>
condition-predicate*[procedure] (condition-predicate* KIND) => (procedure (*) boolean)
Returns a "memoized" condition-predicate for KIND.
condition-property-accessor*[procedure] (condition-property-accessor* KIND PROP [DEFAULT]) => (procedure (*) boolean)
Returns a "memoized" condition-property-accessor for KIND. The default value of DEFAULT is #f.
Bugs & Limitations
- make-exn-condition, make-exn-condition+, and write-exn-condition should be combined with the "standard-conditions.scm" 'exn' predicate & accessors in own "exn-condition" module.
- write-exn-condition is from write-exception of https://github.com/dleslie/geiser/blob/master/scheme/chicken/geiser/emacs.scm.
- added write-exn-condition
- added make-exn-condition
- default exn msg
- added call-chain argument & standard conditions
- Fix for ticket #630
- Hello (from "check-errors:1.11.0")
Copyright (C) 2009-2015 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.