-rw-r--r-- | include/opkele/exception.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/opkele/exception.h b/include/opkele/exception.h index c5f5811..9fc9bd3 100644 --- a/include/opkele/exception.h +++ b/include/opkele/exception.h | |||
@@ -80,131 +80,141 @@ namespace opkele { | |||
80 | exception(const string& w) | 80 | exception(const string& w) |
81 | : _what(w) { } | 81 | : _what(w) { } |
82 | virtual ~exception() throw(); | 82 | virtual ~exception() throw(); |
83 | virtual const char * what() const throw(); | 83 | virtual const char * what() const throw(); |
84 | # endif /* OPKELE_HAVE_KONFORKA */ | 84 | # endif /* OPKELE_HAVE_KONFORKA */ |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * thrown in case of failed conversion | 88 | * thrown in case of failed conversion |
89 | */ | 89 | */ |
90 | class failed_conversion : public exception { | 90 | class failed_conversion : public exception { |
91 | public: | 91 | public: |
92 | failed_conversion(OPKELE_E_PARS) | 92 | failed_conversion(OPKELE_E_PARS) |
93 | : exception(OPKELE_E_CONS) { } | 93 | : exception(OPKELE_E_CONS) { } |
94 | }; | 94 | }; |
95 | /** | 95 | /** |
96 | * thrown in case of failed lookup (either parameter or persistent store) | 96 | * thrown in case of failed lookup (either parameter or persistent store) |
97 | */ | 97 | */ |
98 | class failed_lookup : public exception { | 98 | class failed_lookup : public exception { |
99 | public: | 99 | public: |
100 | failed_lookup(OPKELE_E_PARS) | 100 | failed_lookup(OPKELE_E_PARS) |
101 | : exception(OPKELE_E_CONS) { } | 101 | : exception(OPKELE_E_CONS) { } |
102 | }; | 102 | }; |
103 | /** | 103 | /** |
104 | * thrown in case of bad input (either local or network) | 104 | * thrown in case of bad input (either local or network) |
105 | */ | 105 | */ |
106 | class bad_input : public exception { | 106 | class bad_input : public exception { |
107 | public: | 107 | public: |
108 | bad_input(OPKELE_E_PARS) | 108 | bad_input(OPKELE_E_PARS) |
109 | : exception(OPKELE_E_CONS) { } | 109 | : exception(OPKELE_E_CONS) { } |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * thrown on failed assertion | 113 | * thrown on failed assertion |
114 | */ | 114 | */ |
115 | class failed_assertion : public exception { | 115 | class failed_assertion : public exception { |
116 | public: | 116 | public: |
117 | failed_assertion(OPKELE_E_PARS) | 117 | failed_assertion(OPKELE_E_PARS) |
118 | : exception(OPKELE_E_CONS) { } | 118 | : exception(OPKELE_E_CONS) { } |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * thrown if the handle being retrieved is invalid | 122 | * thrown if the handle being retrieved is invalid |
123 | */ | 123 | */ |
124 | class invalid_handle : public exception { | 124 | class invalid_handle : public exception { |
125 | public: | 125 | public: |
126 | invalid_handle(OPKELE_E_PARS) | 126 | invalid_handle(OPKELE_E_PARS) |
127 | : exception(OPKELE_E_CONS) { } | 127 | : exception(OPKELE_E_CONS) { } |
128 | }; | 128 | }; |
129 | /** | 129 | /** |
130 | * thrown if the handle passed to check_authentication request is not | 130 | * thrown if the handle passed to check_authentication request is not |
131 | * stateless | 131 | * stateless |
132 | */ | 132 | */ |
133 | class stateful_handle : public exception { | 133 | class stateful_handle : public exception { |
134 | public: | 134 | public: |
135 | stateful_handle(OPKELE_E_PARS) | 135 | stateful_handle(OPKELE_E_PARS) |
136 | : exception(OPKELE_E_CONS) { } | 136 | : exception(OPKELE_E_CONS) { } |
137 | }; | 137 | }; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * thrown if check_authentication request fails | 140 | * thrown if check_authentication request fails |
141 | */ | 141 | */ |
142 | class failed_check_authentication : public exception { | 142 | class failed_check_authentication : public exception { |
143 | public: | 143 | public: |
144 | failed_check_authentication(OPKELE_E_PARS) | 144 | failed_check_authentication(OPKELE_E_PARS) |
145 | : exception(OPKELE_E_CONS) { } | 145 | : exception(OPKELE_E_CONS) { } |
146 | }; | 146 | }; |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * thrown if the id_res request result is negative | 149 | * thrown if the id_res request result is negative |
150 | */ | 150 | */ |
151 | class id_res_failed : public exception { | 151 | class id_res_failed : public exception { |
152 | public: | 152 | public: |
153 | id_res_failed(OPKELE_E_PARS) | 153 | id_res_failed(OPKELE_E_PARS) |
154 | : exception(OPKELE_E_CONS) { } | 154 | : exception(OPKELE_E_CONS) { } |
155 | }; | 155 | }; |
156 | /** | 156 | /** |
157 | * thrown if the user_setup_url is provided with negative response | 157 | * thrown if the user_setup_url is provided with negative response |
158 | */ | 158 | */ |
159 | class id_res_setup : public id_res_failed { | 159 | class id_res_setup : public id_res_failed { |
160 | public: | 160 | public: |
161 | string setup_url; | 161 | string setup_url; |
162 | id_res_setup(OPKELE_E_PARS,const string& su) | 162 | id_res_setup(OPKELE_E_PARS,const string& su) |
163 | : id_res_failed(OPKELE_E_CONS), setup_url(su) { } | 163 | : id_res_failed(OPKELE_E_CONS), setup_url(su) { } |
164 | ~id_res_setup() throw() { } | 164 | ~id_res_setup() throw() { } |
165 | }; | 165 | }; |
166 | /** | 166 | /** |
167 | * thrown in case of signature mismatch | 167 | * thrown in case of signature mismatch |
168 | */ | 168 | */ |
169 | class id_res_mismatch : public id_res_failed { | 169 | class id_res_mismatch : public id_res_failed { |
170 | public: | 170 | public: |
171 | id_res_mismatch(OPKELE_E_PARS) | 171 | id_res_mismatch(OPKELE_E_PARS) |
172 | : id_res_failed(OPKELE_E_CONS) { } | 172 | : id_res_failed(OPKELE_E_CONS) { } |
173 | }; | 173 | }; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * openssl malfunction occured | 176 | * openssl malfunction occured |
177 | */ | 177 | */ |
178 | class exception_openssl : public exception { | 178 | class exception_openssl : public exception { |
179 | public: | 179 | public: |
180 | unsigned long _error; | 180 | unsigned long _error; |
181 | string _ssl_string; | 181 | string _ssl_string; |
182 | exception_openssl(OPKELE_E_PARS); | 182 | exception_openssl(OPKELE_E_PARS); |
183 | ~exception_openssl() throw() { } | 183 | ~exception_openssl() throw() { } |
184 | }; | 184 | }; |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * network operation related error occured | 187 | * network operation related error occured |
188 | */ | 188 | */ |
189 | class exception_network : public exception { | 189 | class exception_network : public exception { |
190 | public: | 190 | public: |
191 | exception_network(OPKELE_E_PARS) | 191 | exception_network(OPKELE_E_PARS) |
192 | : exception(OPKELE_E_CONS) { } | 192 | : exception(OPKELE_E_CONS) { } |
193 | }; | 193 | }; |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * network operation related error occured, specifically, related to | 196 | * network operation related error occured, specifically, related to |
197 | * libcurl | 197 | * libcurl |
198 | */ | 198 | */ |
199 | class exception_curl : public exception_network { | 199 | class exception_curl : public exception_network { |
200 | public: | 200 | public: |
201 | CURLcode _error; | 201 | CURLcode _error; |
202 | string _curl_string; | 202 | string _curl_string; |
203 | exception_curl(OPKELE_E_PARS); | 203 | exception_curl(OPKELE_E_PARS); |
204 | exception_curl(OPKELE_E_PARS,CURLcode e); | 204 | exception_curl(OPKELE_E_PARS,CURLcode e); |
205 | ~exception_curl() throw() { } | 205 | ~exception_curl() throw() { } |
206 | }; | 206 | }; |
207 | 207 | ||
208 | /** | ||
209 | * not implemented (think pure virtual) member function executed, signfies | ||
210 | * programmer error | ||
211 | */ | ||
212 | class not_implemented : public exception { | ||
213 | public: | ||
214 | not_implemented(OPKELE_E_PARS) | ||
215 | : exception(OPKELE_E_CONS) { } | ||
216 | }; | ||
217 | |||
208 | } | 218 | } |
209 | 219 | ||
210 | #endif /* __OPKELE_EXCEPTION_H */ | 220 | #endif /* __OPKELE_EXCEPTION_H */ |