1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 '''
32 Implementation of Exceptions raised by HttxLib
33
34 Because HttxLib is built on top of httplib, all exceptions derive from
35 HTTPException to enable a catch-all case
36 '''
37
38 from httplib import HTTPException
39
40
42 '''
43 A class representing a socket exception like closed connection,
44 timeout, dns failure resolution and others
45
46 HTTPException is HTTP centered, but the HttxLib wants to isolate
47 the user from having to install their own except for a socket
48 exception and therefore socket errors are caught
49 '''
50
52 '''
53 Constructor. Passes the args to Exception as explicitly stated
54 in the HTTPException definition in httplib.py
55
56 @param args: list of arguments
57 @type args: tuple
58 '''
59 Exception.__init__(self, *args)
60
61
62
63 HttxSocketException = SocketException
64
65
67 '''
68 A class representing a HTTP related exceptions raised by HttxLib
69
70 @ivar response: response that has triggered the exception
71 @type response: L{HttxResponse}
72 '''
73
75 '''
76 Constructor. Passes the args to Exception as explicitly stated
77 in the HTTPException definition in httplib.py
78
79 @param response: response that has triggered the exception
80 @type response: L{HttxResponse}
81 @param args: list of arguments
82 @type args: tuple
83 '''
84 Exception.__init__(self, *args)
85 self.response = response
86
87
89 '''
90 A class representing a redirection error (like missing location header,
91 not allowed in a POST request and others)
92 '''
93
95 '''
96 Constructor. Delegates construction to the base class L{HttxException}
97
98 @param response: response that has triggered the exception
99 @type response: L{HttxResponse}
100 @param args: list of arguments
101 @type args: tuple
102 '''
103 HttxException.__init__(self, response, *args)
104
105
107 '''
108 A class representing an error because the configure maxiumum number
109 of redirections has been reached
110 '''
111
113 '''
114 Constructor. Delegates construction to the base class L{HttxException}
115
116 @param response: response that has triggered the exception
117 @type response: L{HttxResponse}
118 @param args: list of arguments
119 @type args: tuple
120 '''
121 HttxException.__init__(self, response, *args)
122
123
125 '''
126 A class representing an error because external redirections are disabled
127 but the response redirected to an external host
128 '''
130 '''
131 Constructor. Delegates construction to the base class L{HttxException}
132
133 @param response: response that has triggered the exception
134 @type response: L{HttxResponse}
135 @param args: list of arguments
136 @type args: tuple
137 '''
138 HttxException.__init__(self, response, *args)
139