source: project/wiki/eggref/4/condition-utils @ 31307

Last change on this file since 31307 was 31307, checked in by Kon Lovett, 7 years ago

rel 1.0.4

File size: 3.8 KB
Line 
1[[tags: egg]]
2
3== condition-utils
4
5SRFI 12 Condition Utilities
6
7[[toc:]]
8
9
10== Documentation
11
12Convenience API for constructing common Chicken exception conditions,
13predicates, and accessors.
14
15=== Argument Conventions
16
17{{LOC}} is a {{symbol}}, or {{#f}}.
18
19{{MSG}} is a {{string}}, or {{#f}}.
20
21{{ARGS}} is a {{list}}, or {{#f}}.
22
23{{CHN}} is the result of {{(get-call-chain)}}, or {{#f}}.
24
25{{COND}} is a:
26
27; {{property-condition}} : literal
28; {{symbol}} : {{(make-property-condition <symbol>)}}
29; {{list}} : {{(apply make-property-condition <list>)}}
30
31{{KIND}} is a {{symbol}}.
32
33{{PROP}} is a {{symbol}}.
34
35=== make-exn-condition
36
37<procedure>(make-exn-condition [LOC [MSG [ARGS [CHN]]]]) => property-condition</procedure>
38
39Returns an {{exn}} {{property-condition}} with optional {{location}},
40{{arguments}}, and {{call-chain}} property values.
41
42Defaults:
43
44; {{LOC}} : missing
45; {{MSG}} : {{"unknown"}}
46; {{ARGS}} : missing
47; {{CHN}} : missing
48
49Will always include {{message}} property in the {{property-condition}}.
50
51=== make-exn-condition+
52
53<procedure>(make-exn-condition+ LOC MSG ARGS [CHN] [COND...]) => property-condition</procedure>
54
55Returns a {{composite-condition}} {{exn COND...}}.
56
57When one-of {{LOC}}, {{MSG}}, or {{ARGS}} is without a useful value in the
58error context use {{#f}} as the actual argument. The optional {{CHN}} argument
59is detected by structure.
60
61When {{MSG}} is {{#f}} the value {{"unknown"}} is used.
62
63=== make-condition+
64
65<procedure>(make-condition+ COND...) => property-condition</procedure>
66
67Returns a {{composite-condition}} {{COND...}}.
68
69=== condition-predicate*
70
71<procedure>(condition-predicate* KIND) => (procedure (*) boolean)</procedure>
72
73Returns a "memioized" {{condition-predicate}} for {{KIND}}.
74
75=== make-condition-predicate
76
77<macro>(make-condition-predicate KIND...) => (procedure (*) boolean)</macro>
78
79Returns a {{condition-predicate}} for {{KIND...}}.
80
81=== condition-property-accessor*
82
83<procedure>(condition-property-accessor* KIND PROP [DEFAULT]) => (procedure (*) boolean)</procedure>
84
85Returns a "memioized" {{condition-property-accessor}} for {{KIND}}.
86
87=== make-condition-property-accessor
88
89<macro>(make-condition-property-accessor KIND PROP [DEFAULT]) => (procedure (*) boolean)</macro>
90
91Returns a {{condition-property-accessor}} for {{KIND PROP}}.
92
93=== condition-irritants
94
95<procedure>(condition-irritants EXN) => list</procedure>
96
97Returns a property list of the condition properties for the condition {{EXN}}.
98The properties are without associated condition information.
99
100
101== Usage
102
103<enscript language=scheme>
104(require-extension condition-utils)
105</enscript>
106
107
108== Author
109
110[[/users/kon-lovett|Kon Lovett]]
111
112
113== Version history
114
115; 1.0.4 : default exn msg
116; 1.0.3 : added call-chain argument & standard conditions
117; 1.0.2 : Fix for ticket #630
118; 1.0.1 :
119; 1.0.0 : Hello (from "check-errors:1.11.0")
120
121
122== License
123
124Copyright (C) 2009-2014 Kon Lovett.  All rights reserved.
125
126Permission is hereby granted, free of charge, to any person obtaining a
127copy of this software and associated documentation files (the Software),
128to deal in the Software without restriction, including without limitation
129the rights to use, copy, modify, merge, publish, distribute, sublicense,
130and/or sell copies of the Software, and to permit persons to whom the
131Software is furnished to do so, subject to the following conditions:
132
133The above copyright notice and this permission notice shall be included
134in all copies or substantial portions of the Software.
135
136THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
137IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
138FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
139THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
140OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
141ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
142OTHER DEALINGS IN THE SOFTWARE.
Note: See TracBrowser for help on using the repository browser.