source: project/release/4/condition-utils/trunk/http-client-conditions.scm @ 29490

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

save new conditions

File size: 2.5 KB
Line 
1;;;; http-client-conditions.scm
2;;;; Kon Lovett, Jun '13
3
4(module http-client-conditions
5
6  (;export
7    ;
8    http-condition?
9    ;
10    client-error-condition?
11    client-error-response
12    client-error-body
13    ;
14    server-error-condition?
15    server-error-response
16    server-error-body
17    ;
18    unexpected-server-response-condition?
19    unexpected-server-response-response
20    unexpected-server-response-body
21    ;
22    redirect-depth-exceeded-condition?
23    redirect-depth-exceeded-uri
24    ;
25    formdata-error-condition?
26    ;
27    unsupported-uri-scheme-condition?
28    unsupported-uri-scheme-uri-scheme
29    unsupported-uri-scheme-request-uri
30    ;
31    unknown-authtype-condition?
32    unknown-authtype-authtype
33  )
34
35  (import scheme chicken)
36
37  (use condition-utils)
38
39;;
40
41;from intraweb
42(define http-condition?
43  (make-condition-predicate exn http))
44
45;;
46
47(define client-error-condition?
48  (make-condition-predicate exn http client-error))
49
50(define client-error-response
51  (make-condition-property-accessor client-error response))
52
53(define client-error-body
54  (make-condition-property-accessor client-error body))
55
56;;
57
58(define server-error-condition?
59  (make-condition-predicate exn http server-error))
60
61(define server-error-response
62  (make-condition-property-accessor server-error response))
63
64(define server-error-body
65  (make-condition-property-accessor server-error body))
66
67;;
68
69(define unexpected-server-response-condition?
70  (make-condition-predicate exn http unexpected-server-response))
71
72(define unexpected-server-response-response
73  (make-condition-property-accessor unexpected-server-response response))
74
75(define unexpected-server-response-body
76  (make-condition-property-accessor unexpected-server-response body))
77
78;;
79
80(define redirect-depth-exceeded-condition?
81  (make-condition-predicate exn http redirect-depth-exceeded))
82
83(define redirect-depth-exceeded-uri
84  (make-condition-property-accessor server-error uri))
85
86;;
87
88(define formdata-error-condition?
89  (make-condition-predicate exn http formdata-error))
90
91;;
92
93(define unsupported-uri-scheme-condition?
94  (make-condition-predicate exn http unsupported-uri-scheme))
95
96(define unsupported-uri-scheme-uri-scheme
97  (make-condition-property-accessor server-error uri-scheme))
98
99(define unsupported-uri-scheme-request-uri
100  (make-condition-property-accessor server-error request-uri))
101
102;;
103
104(define unknown-authtype-condition?
105  (make-condition-predicate exn http unknown-authtype))
106
107(define unknown-authtype-authtype
108  (make-condition-property-accessor server-error authtype))
109
110) ;http-client-conditions
Note: See TracBrowser for help on using the repository browser.