-rw-r--r-- | include/opkele/exception.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/opkele/exception.h b/include/opkele/exception.h index 64f189e..d003ce4 100644 --- a/include/opkele/exception.h +++ b/include/opkele/exception.h | |||
@@ -91,169 +91,187 @@ namespace opkele { | |||
91 | */ | 91 | */ |
92 | class failed_conversion : public exception { | 92 | class failed_conversion : public exception { |
93 | public: | 93 | public: |
94 | failed_conversion(OPKELE_E_PARS) | 94 | failed_conversion(OPKELE_E_PARS) |
95 | : exception(OPKELE_E_CONS) { } | 95 | : exception(OPKELE_E_CONS) { } |
96 | }; | 96 | }; |
97 | /** | 97 | /** |
98 | * thrown in case of failed lookup (either parameter or persistent store) | 98 | * thrown in case of failed lookup (either parameter or persistent store) |
99 | */ | 99 | */ |
100 | class failed_lookup : public exception { | 100 | class failed_lookup : public exception { |
101 | public: | 101 | public: |
102 | failed_lookup(OPKELE_E_PARS) | 102 | failed_lookup(OPKELE_E_PARS) |
103 | : exception(OPKELE_E_CONS) { } | 103 | : exception(OPKELE_E_CONS) { } |
104 | }; | 104 | }; |
105 | /** | 105 | /** |
106 | * thrown in case of bad input (either local or network) | 106 | * thrown in case of bad input (either local or network) |
107 | */ | 107 | */ |
108 | class bad_input : public exception { | 108 | class bad_input : public exception { |
109 | public: | 109 | public: |
110 | bad_input(OPKELE_E_PARS) | 110 | bad_input(OPKELE_E_PARS) |
111 | : exception(OPKELE_E_CONS) { } | 111 | : exception(OPKELE_E_CONS) { } |
112 | }; | 112 | }; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * thrown on failed assertion | 115 | * thrown on failed assertion |
116 | */ | 116 | */ |
117 | class failed_assertion : public exception { | 117 | class failed_assertion : public exception { |
118 | public: | 118 | public: |
119 | failed_assertion(OPKELE_E_PARS) | 119 | failed_assertion(OPKELE_E_PARS) |
120 | : exception(OPKELE_E_CONS) { } | 120 | : exception(OPKELE_E_CONS) { } |
121 | }; | 121 | }; |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * thrown if the handle being retrieved is invalid | 124 | * thrown if the handle being retrieved is invalid |
125 | */ | 125 | */ |
126 | class invalid_handle : public exception { | 126 | class invalid_handle : public exception { |
127 | public: | 127 | public: |
128 | invalid_handle(OPKELE_E_PARS) | 128 | invalid_handle(OPKELE_E_PARS) |
129 | : exception(OPKELE_E_CONS) { } | 129 | : exception(OPKELE_E_CONS) { } |
130 | }; | 130 | }; |
131 | /** | 131 | /** |
132 | * thrown if the handle passed to check_authentication request is not | 132 | * thrown if the handle passed to check_authentication request is not |
133 | * stateless | 133 | * stateless |
134 | */ | 134 | */ |
135 | class stateful_handle : public exception { | 135 | class stateful_handle : public exception { |
136 | public: | 136 | public: |
137 | stateful_handle(OPKELE_E_PARS) | 137 | stateful_handle(OPKELE_E_PARS) |
138 | : exception(OPKELE_E_CONS) { } | 138 | : exception(OPKELE_E_CONS) { } |
139 | }; | 139 | }; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * thrown if check_authentication request fails | 142 | * thrown if check_authentication request fails |
143 | */ | 143 | */ |
144 | class failed_check_authentication : public exception { | 144 | class failed_check_authentication : public exception { |
145 | public: | 145 | public: |
146 | failed_check_authentication(OPKELE_E_PARS) | 146 | failed_check_authentication(OPKELE_E_PARS) |
147 | : exception(OPKELE_E_CONS) { } | 147 | : exception(OPKELE_E_CONS) { } |
148 | }; | 148 | }; |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * thrown if the id_res request result is negative | 151 | * thrown if the id_res request result is negative |
152 | */ | 152 | */ |
153 | class id_res_failed : public exception { | 153 | class id_res_failed : public exception { |
154 | public: | 154 | public: |
155 | id_res_failed(OPKELE_E_PARS) | 155 | id_res_failed(OPKELE_E_PARS) |
156 | : exception(OPKELE_E_CONS) { } | 156 | : exception(OPKELE_E_CONS) { } |
157 | }; | 157 | }; |
158 | /** | 158 | /** |
159 | * thrown if the user_setup_url is provided with negative response | 159 | * thrown if the user_setup_url is provided with negative response |
160 | */ | 160 | */ |
161 | class id_res_setup : public id_res_failed { | 161 | class id_res_setup : public id_res_failed { |
162 | public: | 162 | public: |
163 | string setup_url; | 163 | string setup_url; |
164 | id_res_setup(OPKELE_E_PARS,const string& su) | 164 | id_res_setup(OPKELE_E_PARS,const string& su) |
165 | : id_res_failed(OPKELE_E_CONS), setup_url(su) { } | 165 | : id_res_failed(OPKELE_E_CONS), setup_url(su) { } |
166 | ~id_res_setup() throw() { } | 166 | ~id_res_setup() throw() { } |
167 | }; | 167 | }; |
168 | /** | 168 | /** |
169 | * thrown in case of signature mismatch | 169 | * thrown in case of signature mismatch |
170 | */ | 170 | */ |
171 | class id_res_mismatch : public id_res_failed { | 171 | class id_res_mismatch : public id_res_failed { |
172 | public: | 172 | public: |
173 | id_res_mismatch(OPKELE_E_PARS) | 173 | id_res_mismatch(OPKELE_E_PARS) |
174 | : id_res_failed(OPKELE_E_CONS) { } | 174 | : id_res_failed(OPKELE_E_CONS) { } |
175 | }; | 175 | }; |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * thrown if the association has expired before it could've been verified. | 178 | * thrown if the association has expired before it could've been verified. |
179 | */ | 179 | */ |
180 | class id_res_expired_on_delivery : public id_res_failed { | 180 | class id_res_expired_on_delivery : public id_res_failed { |
181 | public: | 181 | public: |
182 | id_res_expired_on_delivery(OPKELE_E_PARS) | 182 | id_res_expired_on_delivery(OPKELE_E_PARS) |
183 | : id_res_failed(OPKELE_E_CONS) { } | 183 | : id_res_failed(OPKELE_E_CONS) { } |
184 | }; | 184 | }; |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * thown when the user cancelled authentication process. | ||
188 | */ | ||
189 | class id_res_cancel : public id_res_failed { | ||
190 | public: | ||
191 | id_res_cancel(OPKELE_E_PARS) | ||
192 | : id_res_failed(OPKELE_E_CONS) { } | ||
193 | }; | ||
194 | |||
195 | /** | ||
196 | * thrown in case of nonce reuse or otherwise imperfect nonce. | ||
197 | */ | ||
198 | class id_res_bad_nonce : public id_res_failed { | ||
199 | public: | ||
200 | id_res_bad_nonce(OPKELE_E_PARS) | ||
201 | : id_res_failed(OPKELE_E_CONS) { } | ||
202 | }; | ||
203 | |||
204 | /** | ||
187 | * openssl malfunction occured | 205 | * openssl malfunction occured |
188 | */ | 206 | */ |
189 | class exception_openssl : public exception { | 207 | class exception_openssl : public exception { |
190 | public: | 208 | public: |
191 | unsigned long _error; | 209 | unsigned long _error; |
192 | string _ssl_string; | 210 | string _ssl_string; |
193 | exception_openssl(OPKELE_E_PARS); | 211 | exception_openssl(OPKELE_E_PARS); |
194 | ~exception_openssl() throw() { } | 212 | ~exception_openssl() throw() { } |
195 | }; | 213 | }; |
196 | 214 | ||
197 | /** | 215 | /** |
198 | * network operation related error occured | 216 | * network operation related error occured |
199 | */ | 217 | */ |
200 | class exception_network : public exception { | 218 | class exception_network : public exception { |
201 | public: | 219 | public: |
202 | exception_network(OPKELE_E_PARS) | 220 | exception_network(OPKELE_E_PARS) |
203 | : exception(OPKELE_E_CONS) { } | 221 | : exception(OPKELE_E_CONS) { } |
204 | }; | 222 | }; |
205 | 223 | ||
206 | /** | 224 | /** |
207 | * network operation related error occured, specifically, related to | 225 | * network operation related error occured, specifically, related to |
208 | * libcurl | 226 | * libcurl |
209 | */ | 227 | */ |
210 | class exception_curl : public exception_network { | 228 | class exception_curl : public exception_network { |
211 | public: | 229 | public: |
212 | CURLcode _error; | 230 | CURLcode _error; |
213 | string _curl_string; | 231 | string _curl_string; |
214 | exception_curl(OPKELE_E_PARS); | 232 | exception_curl(OPKELE_E_PARS); |
215 | exception_curl(OPKELE_E_PARS,CURLcode e); | 233 | exception_curl(OPKELE_E_PARS,CURLcode e); |
216 | ~exception_curl() throw() { } | 234 | ~exception_curl() throw() { } |
217 | }; | 235 | }; |
218 | 236 | ||
219 | /** | 237 | /** |
220 | * exception thrown in case of failed discovery | 238 | * exception thrown in case of failed discovery |
221 | */ | 239 | */ |
222 | class failed_discovery : public exception { | 240 | class failed_discovery : public exception { |
223 | public: | 241 | public: |
224 | failed_discovery(OPKELE_E_PARS) | 242 | failed_discovery(OPKELE_E_PARS) |
225 | : exception(OPKELE_E_CONS) { } | 243 | : exception(OPKELE_E_CONS) { } |
226 | }; | 244 | }; |
227 | 245 | ||
228 | /** | 246 | /** |
229 | * unsuccessfull xri resolution | 247 | * unsuccessfull xri resolution |
230 | */ | 248 | */ |
231 | class failed_xri_resolution : public failed_discovery { | 249 | class failed_xri_resolution : public failed_discovery { |
232 | public: | 250 | public: |
233 | long _code; | 251 | long _code; |
234 | failed_xri_resolution(OPKELE_E_PARS,long _c=-1) | 252 | failed_xri_resolution(OPKELE_E_PARS,long _c=-1) |
235 | : failed_discovery(OPKELE_E_CONS), _code(_c) { } | 253 | : failed_discovery(OPKELE_E_CONS), _code(_c) { } |
236 | }; | 254 | }; |
237 | 255 | ||
238 | /** | 256 | /** |
239 | * not implemented (think pure virtual) member function executed, signfies | 257 | * not implemented (think pure virtual) member function executed, signfies |
240 | * programmer error | 258 | * programmer error |
241 | */ | 259 | */ |
242 | class not_implemented : public exception { | 260 | class not_implemented : public exception { |
243 | public: | 261 | public: |
244 | not_implemented(OPKELE_E_PARS) | 262 | not_implemented(OPKELE_E_PARS) |
245 | : exception(OPKELE_E_CONS) { } | 263 | : exception(OPKELE_E_CONS) { } |
246 | }; | 264 | }; |
247 | 265 | ||
248 | /** | 266 | /** |
249 | * internal error, indicates internal libopkele problem | 267 | * internal error, indicates internal libopkele problem |
250 | */ | 268 | */ |
251 | class internal_error : public exception { | 269 | class internal_error : public exception { |
252 | public: | 270 | public: |
253 | internal_error(OPKELE_E_PARS) | 271 | internal_error(OPKELE_E_PARS) |
254 | : exception(OPKELE_E_CONS) { } | 272 | : exception(OPKELE_E_CONS) { } |
255 | }; | 273 | }; |
256 | 274 | ||
257 | } | 275 | } |
258 | 276 | ||
259 | #endif /* __OPKELE_EXCEPTION_H */ | 277 | #endif /* __OPKELE_EXCEPTION_H */ |