summaryrefslogtreecommitdiffabout
path: root/include/opkele/exception.h
Unidiff
Diffstat (limited to 'include/opkele/exception.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/exception.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/include/opkele/exception.h b/include/opkele/exception.h
index 9fc9bd3..0150e6b 100644
--- a/include/opkele/exception.h
+++ b/include/opkele/exception.h
@@ -1,220 +1,217 @@
1#ifndef __OPKELE_EXCEPTION_H 1#ifndef __OPKELE_EXCEPTION_H
2#define __OPKELE_EXCEPTION_H 2#define __OPKELE_EXCEPTION_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief opkele exceptions 6 * @brief opkele exceptions
7 */ 7 */
8 8
9#include <curl/curl.h> 9#include <curl/curl.h>
10 10
11#include <opkele/opkele-config.h> 11#include <opkele/opkele-config.h>
12#ifdef OPKELE_HAVE_KONFORKA 12#ifdef OPKELE_HAVE_KONFORKA
13# include <konforka/exception.h> 13# include <konforka/exception.h>
14/** 14/**
15 * the exception parameters declaration 15 * the exception parameters declaration
16 */ 16 */
17# define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w 17# define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w
18/** 18/**
19 * the exception parameters list to pass to constructor 19 * the exception parameters list to pass to constructor
20 */ 20 */
21# define OPKELE_E_CONS_ fi,fu,l, 21# define OPKELE_E_CONS_ fi,fu,l,
22/** 22/**
23 * the exception codepoint specification 23 * the exception codepoint specification
24 */ 24 */
25# define OPKELE_CP_ CODEPOINT, 25# define OPKELE_CP_ CODEPOINT,
26/** 26/**
27 * the simple rethrow of konforka-based exception 27 * the simple rethrow of konforka-based exception
28 */ 28 */
29# define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw } 29# define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw }
30#else /* OPKELE_HAVE_KONFORKA */ 30#else /* OPKELE_HAVE_KONFORKA */
31# include <exception> 31# include <exception>
32# include <string> 32# include <string>
33/** 33/**
34 * the exception parameter declaration 34 * the exception parameter declaration
35 */ 35 */
36# define OPKELE_E_PARS const string& w 36# define OPKELE_E_PARS const string& w
37/** 37/**
38 * the dummy prefix for exception parameters list to prepend in the absence of 38 * the dummy prefix for exception parameters list to prepend in the absence of
39 * konforka library 39 * konforka library
40 */ 40 */
41# define OPKELE_E_CONS_ 41# define OPKELE_E_CONS_
42/** 42/**
43 * the dummy placeholder for konforka exception codepoint specification 43 * the dummy placeholder for konforka exception codepoint specification
44 */ 44 */
45# define OPKELE_CP_ 45# define OPKELE_CP_
46/** 46/**
47 * the dummy define for the konforka-based rethrow of exception 47 * the dummy define for the konforka-based rethrow of exception
48 */ 48 */
49# define OPKELE_RETHROW 49# define OPKELE_RETHROW
50#endif /* OPKELE_HAVE_KONFORKA */ 50#endif /* OPKELE_HAVE_KONFORKA */
51/** 51/**
52 * the exception parameters list to pass to constructor 52 * the exception parameters list to pass to constructor
53 */ 53 */
54# define OPKELE_E_CONS OPKELE_E_CONS_ w 54# define OPKELE_E_CONS OPKELE_E_CONS_ w
55 55
56/*
57 * @brief the main opkele namespace
58 */
59namespace opkele { 56namespace opkele {
60 using std::string; 57 using std::string;
61 58
62 /** 59 /**
63 * the base opkele exception class 60 * the base opkele exception class
64 */ 61 */
65 class exception : public 62 class exception : public
66# ifdef OPKELE_HAVE_KONFORKA 63# ifdef OPKELE_HAVE_KONFORKA
67 konforka::exception 64 konforka::exception
68# else 65# else
69 std::exception 66 std::exception
70# endif 67# endif
71 { 68 {
72 public: 69 public:
73# ifdef OPKELE_HAVE_KONFORKA 70# ifdef OPKELE_HAVE_KONFORKA
74 explicit 71 explicit
75 exception(const string& fi,const string& fu,int l,const string& w) 72 exception(const string& fi,const string& fu,int l,const string& w)
76 : konforka::exception(fi,fu,l,w) { } 73 : konforka::exception(fi,fu,l,w) { }
77# else /* OPKELE_HAVE_KONFORKA */ 74# else /* OPKELE_HAVE_KONFORKA */
78 string _what; 75 string _what;
79 explicit 76 explicit
80 exception(const string& w) 77 exception(const string& w)
81 : _what(w) { } 78 : _what(w) { }
82 virtual ~exception() throw(); 79 virtual ~exception() throw();
83 virtual const char * what() const throw(); 80 virtual const char * what() const throw();
84# endif /* OPKELE_HAVE_KONFORKA */ 81# endif /* OPKELE_HAVE_KONFORKA */
85 }; 82 };
86 83
87 /** 84 /**
88 * thrown in case of failed conversion 85 * thrown in case of failed conversion
89 */ 86 */
90 class failed_conversion : public exception { 87 class failed_conversion : public exception {
91 public: 88 public:
92 failed_conversion(OPKELE_E_PARS) 89 failed_conversion(OPKELE_E_PARS)
93 : exception(OPKELE_E_CONS) { } 90 : exception(OPKELE_E_CONS) { }
94 }; 91 };
95 /** 92 /**
96 * thrown in case of failed lookup (either parameter or persistent store) 93 * thrown in case of failed lookup (either parameter or persistent store)
97 */ 94 */
98 class failed_lookup : public exception { 95 class failed_lookup : public exception {
99 public: 96 public:
100 failed_lookup(OPKELE_E_PARS) 97 failed_lookup(OPKELE_E_PARS)
101 : exception(OPKELE_E_CONS) { } 98 : exception(OPKELE_E_CONS) { }
102 }; 99 };
103 /** 100 /**
104 * thrown in case of bad input (either local or network) 101 * thrown in case of bad input (either local or network)
105 */ 102 */
106 class bad_input : public exception { 103 class bad_input : public exception {
107 public: 104 public:
108 bad_input(OPKELE_E_PARS) 105 bad_input(OPKELE_E_PARS)
109 : exception(OPKELE_E_CONS) { } 106 : exception(OPKELE_E_CONS) { }
110 }; 107 };
111 108
112 /** 109 /**
113 * thrown on failed assertion 110 * thrown on failed assertion
114 */ 111 */
115 class failed_assertion : public exception { 112 class failed_assertion : public exception {
116 public: 113 public:
117 failed_assertion(OPKELE_E_PARS) 114 failed_assertion(OPKELE_E_PARS)
118 : exception(OPKELE_E_CONS) { } 115 : exception(OPKELE_E_CONS) { }
119 }; 116 };
120 117
121 /** 118 /**
122 * thrown if the handle being retrieved is invalid 119 * thrown if the handle being retrieved is invalid
123 */ 120 */
124 class invalid_handle : public exception { 121 class invalid_handle : public exception {
125 public: 122 public:
126 invalid_handle(OPKELE_E_PARS) 123 invalid_handle(OPKELE_E_PARS)
127 : exception(OPKELE_E_CONS) { } 124 : exception(OPKELE_E_CONS) { }
128 }; 125 };
129 /** 126 /**
130 * thrown if the handle passed to check_authentication request is not 127 * thrown if the handle passed to check_authentication request is not
131 * stateless 128 * stateless
132 */ 129 */
133 class stateful_handle : public exception { 130 class stateful_handle : public exception {
134 public: 131 public:
135 stateful_handle(OPKELE_E_PARS) 132 stateful_handle(OPKELE_E_PARS)
136 : exception(OPKELE_E_CONS) { } 133 : exception(OPKELE_E_CONS) { }
137 }; 134 };
138 135
139 /** 136 /**
140 * thrown if check_authentication request fails 137 * thrown if check_authentication request fails
141 */ 138 */
142 class failed_check_authentication : public exception { 139 class failed_check_authentication : public exception {
143 public: 140 public:
144 failed_check_authentication(OPKELE_E_PARS) 141 failed_check_authentication(OPKELE_E_PARS)
145 : exception(OPKELE_E_CONS) { } 142 : exception(OPKELE_E_CONS) { }
146 }; 143 };
147 144
148 /** 145 /**
149 * thrown if the id_res request result is negative 146 * thrown if the id_res request result is negative
150 */ 147 */
151 class id_res_failed : public exception { 148 class id_res_failed : public exception {
152 public: 149 public:
153 id_res_failed(OPKELE_E_PARS) 150 id_res_failed(OPKELE_E_PARS)
154 : exception(OPKELE_E_CONS) { } 151 : exception(OPKELE_E_CONS) { }
155 }; 152 };
156 /** 153 /**
157 * thrown if the user_setup_url is provided with negative response 154 * thrown if the user_setup_url is provided with negative response
158 */ 155 */
159 class id_res_setup : public id_res_failed { 156 class id_res_setup : public id_res_failed {
160 public: 157 public:
161 string setup_url; 158 string setup_url;
162 id_res_setup(OPKELE_E_PARS,const string& su) 159 id_res_setup(OPKELE_E_PARS,const string& su)
163 : id_res_failed(OPKELE_E_CONS), setup_url(su) { } 160 : id_res_failed(OPKELE_E_CONS), setup_url(su) { }
164 ~id_res_setup() throw() { } 161 ~id_res_setup() throw() { }
165 }; 162 };
166 /** 163 /**
167 * thrown in case of signature mismatch 164 * thrown in case of signature mismatch
168 */ 165 */
169 class id_res_mismatch : public id_res_failed { 166 class id_res_mismatch : public id_res_failed {
170 public: 167 public:
171 id_res_mismatch(OPKELE_E_PARS) 168 id_res_mismatch(OPKELE_E_PARS)
172 : id_res_failed(OPKELE_E_CONS) { } 169 : id_res_failed(OPKELE_E_CONS) { }
173 }; 170 };
174 171
175 /** 172 /**
176 * openssl malfunction occured 173 * openssl malfunction occured
177 */ 174 */
178 class exception_openssl : public exception { 175 class exception_openssl : public exception {
179 public: 176 public:
180 unsigned long _error; 177 unsigned long _error;
181 string _ssl_string; 178 string _ssl_string;
182 exception_openssl(OPKELE_E_PARS); 179 exception_openssl(OPKELE_E_PARS);
183 ~exception_openssl() throw() { } 180 ~exception_openssl() throw() { }
184 }; 181 };
185 182
186 /** 183 /**
187 * network operation related error occured 184 * network operation related error occured
188 */ 185 */
189 class exception_network : public exception { 186 class exception_network : public exception {
190 public: 187 public:
191 exception_network(OPKELE_E_PARS) 188 exception_network(OPKELE_E_PARS)
192 : exception(OPKELE_E_CONS) { } 189 : exception(OPKELE_E_CONS) { }
193 }; 190 };
194 191
195 /** 192 /**
196 * network operation related error occured, specifically, related to 193 * network operation related error occured, specifically, related to
197 * libcurl 194 * libcurl
198 */ 195 */
199 class exception_curl : public exception_network { 196 class exception_curl : public exception_network {
200 public: 197 public:
201 CURLcode _error; 198 CURLcode _error;
202 string _curl_string; 199 string _curl_string;
203 exception_curl(OPKELE_E_PARS); 200 exception_curl(OPKELE_E_PARS);
204 exception_curl(OPKELE_E_PARS,CURLcode e); 201 exception_curl(OPKELE_E_PARS,CURLcode e);
205 ~exception_curl() throw() { } 202 ~exception_curl() throw() { }
206 }; 203 };
207 204
208 /** 205 /**
209 * not implemented (think pure virtual) member function executed, signfies 206 * not implemented (think pure virtual) member function executed, signfies
210 * programmer error 207 * programmer error
211 */ 208 */
212 class not_implemented : public exception { 209 class not_implemented : public exception {
213 public: 210 public:
214 not_implemented(OPKELE_E_PARS) 211 not_implemented(OPKELE_E_PARS)
215 : exception(OPKELE_E_CONS) { } 212 : exception(OPKELE_E_CONS) { }
216 }; 213 };
217 214
218} 215}
219 216
220#endif /* __OPKELE_EXCEPTION_H */ 217#endif /* __OPKELE_EXCEPTION_H */