-rw-r--r-- | include/opkele/exception.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/include/opkele/exception.h b/include/opkele/exception.h index d003ce4..c200a13 100644 --- a/include/opkele/exception.h +++ b/include/opkele/exception.h | |||
@@ -116,162 +116,190 @@ namespace opkele { | |||
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. | 187 | * thown when the user cancelled authentication process. |
188 | */ | 188 | */ |
189 | class id_res_cancel : public id_res_failed { | 189 | class id_res_cancel : public id_res_failed { |
190 | public: | 190 | public: |
191 | id_res_cancel(OPKELE_E_PARS) | 191 | id_res_cancel(OPKELE_E_PARS) |
192 | : id_res_failed(OPKELE_E_CONS) { } | 192 | : id_res_failed(OPKELE_E_CONS) { } |
193 | }; | 193 | }; |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * thrown in case of nonce reuse or otherwise imperfect nonce. | 196 | * thrown in case of nonce reuse or otherwise imperfect nonce. |
197 | */ | 197 | */ |
198 | class id_res_bad_nonce : public id_res_failed { | 198 | class id_res_bad_nonce : public id_res_failed { |
199 | public: | 199 | public: |
200 | id_res_bad_nonce(OPKELE_E_PARS) | 200 | id_res_bad_nonce(OPKELE_E_PARS) |
201 | : id_res_failed(OPKELE_E_CONS) { } | 201 | : id_res_failed(OPKELE_E_CONS) { } |
202 | }; | 202 | }; |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * thrown if return_to didn't pass verification | ||
206 | */ | ||
207 | class id_res_bad_return_to : public id_res_failed { | ||
208 | public: | ||
209 | id_res_bad_return_to(OPKELE_E_PARS) | ||
210 | : id_res_failed(OPKELE_E_CONS) { } | ||
211 | }; | ||
212 | |||
213 | /** | ||
214 | * thrown if OP isn't authorized to make an assertion | ||
215 | */ | ||
216 | class id_res_unauthorized : public id_res_failed { | ||
217 | public: | ||
218 | id_res_unauthorized(OPKELE_E_PARS) | ||
219 | : id_res_failed(OPKELE_E_CONS) { } | ||
220 | }; | ||
221 | |||
222 | /** | ||
205 | * openssl malfunction occured | 223 | * openssl malfunction occured |
206 | */ | 224 | */ |
207 | class exception_openssl : public exception { | 225 | class exception_openssl : public exception { |
208 | public: | 226 | public: |
209 | unsigned long _error; | 227 | unsigned long _error; |
210 | string _ssl_string; | 228 | string _ssl_string; |
211 | exception_openssl(OPKELE_E_PARS); | 229 | exception_openssl(OPKELE_E_PARS); |
212 | ~exception_openssl() throw() { } | 230 | ~exception_openssl() throw() { } |
213 | }; | 231 | }; |
214 | 232 | ||
215 | /** | 233 | /** |
216 | * network operation related error occured | 234 | * network operation related error occured |
217 | */ | 235 | */ |
218 | class exception_network : public exception { | 236 | class exception_network : public exception { |
219 | public: | 237 | public: |
220 | exception_network(OPKELE_E_PARS) | 238 | exception_network(OPKELE_E_PARS) |
221 | : exception(OPKELE_E_CONS) { } | 239 | : exception(OPKELE_E_CONS) { } |
222 | }; | 240 | }; |
223 | 241 | ||
224 | /** | 242 | /** |
225 | * network operation related error occured, specifically, related to | 243 | * network operation related error occured, specifically, related to |
226 | * libcurl | 244 | * libcurl |
227 | */ | 245 | */ |
228 | class exception_curl : public exception_network { | 246 | class exception_curl : public exception_network { |
229 | public: | 247 | public: |
230 | CURLcode _error; | 248 | CURLcode _error; |
231 | string _curl_string; | 249 | string _curl_string; |
232 | exception_curl(OPKELE_E_PARS); | 250 | exception_curl(OPKELE_E_PARS); |
233 | exception_curl(OPKELE_E_PARS,CURLcode e); | 251 | exception_curl(OPKELE_E_PARS,CURLcode e); |
234 | ~exception_curl() throw() { } | 252 | ~exception_curl() throw() { } |
235 | }; | 253 | }; |
236 | 254 | ||
237 | /** | 255 | /** |
238 | * exception thrown in case of failed discovery | 256 | * exception thrown in case of failed discovery |
239 | */ | 257 | */ |
240 | class failed_discovery : public exception { | 258 | class failed_discovery : public exception { |
241 | public: | 259 | public: |
242 | failed_discovery(OPKELE_E_PARS) | 260 | failed_discovery(OPKELE_E_PARS) |
243 | : exception(OPKELE_E_CONS) { } | 261 | : exception(OPKELE_E_CONS) { } |
244 | }; | 262 | }; |
245 | 263 | ||
246 | /** | 264 | /** |
247 | * unsuccessfull xri resolution | 265 | * unsuccessfull xri resolution |
248 | */ | 266 | */ |
249 | class failed_xri_resolution : public failed_discovery { | 267 | class failed_xri_resolution : public failed_discovery { |
250 | public: | 268 | public: |
251 | long _code; | 269 | long _code; |
252 | failed_xri_resolution(OPKELE_E_PARS,long _c=-1) | 270 | failed_xri_resolution(OPKELE_E_PARS,long _c=-1) |
253 | : failed_discovery(OPKELE_E_CONS), _code(_c) { } | 271 | : failed_discovery(OPKELE_E_CONS), _code(_c) { } |
254 | }; | 272 | }; |
255 | 273 | ||
256 | /** | 274 | /** |
257 | * not implemented (think pure virtual) member function executed, signfies | 275 | * not implemented (think pure virtual) member function executed, signfies |
258 | * programmer error | 276 | * programmer error |
259 | */ | 277 | */ |
260 | class not_implemented : public exception { | 278 | class not_implemented : public exception { |
261 | public: | 279 | public: |
262 | not_implemented(OPKELE_E_PARS) | 280 | not_implemented(OPKELE_E_PARS) |
263 | : exception(OPKELE_E_CONS) { } | 281 | : exception(OPKELE_E_CONS) { } |
264 | }; | 282 | }; |
265 | 283 | ||
266 | /** | 284 | /** |
267 | * internal error, indicates internal libopkele problem | 285 | * internal error, indicates internal libopkele problem |
268 | */ | 286 | */ |
269 | class internal_error : public exception { | 287 | class internal_error : public exception { |
270 | public: | 288 | public: |
271 | internal_error(OPKELE_E_PARS) | 289 | internal_error(OPKELE_E_PARS) |
272 | : exception(OPKELE_E_CONS) { } | 290 | : exception(OPKELE_E_CONS) { } |
273 | }; | 291 | }; |
274 | 292 | ||
293 | /** | ||
294 | * thrown in case of unsupported parameter encountered (e.g. unsupported | ||
295 | * association type). | ||
296 | */ | ||
297 | class unsupported : public exception { | ||
298 | public: | ||
299 | unsupported(OPKELE_E_PARS) | ||
300 | : exception(OPKELE_E_CONS) { } | ||
301 | }; | ||
302 | |||
275 | } | 303 | } |
276 | 304 | ||
277 | #endif /* __OPKELE_EXCEPTION_H */ | 305 | #endif /* __OPKELE_EXCEPTION_H */ |