1 //
2 // VMime library (http://www.vmime.org)
3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 3 of
8 // the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Linking this library statically or dynamically with other modules is making
20 // a combined work based on this library.  Thus, the terms and conditions of
21 // the GNU General Public License cover the whole combination.
22 //
23 
24 #include "vmime/exception.hpp"
25 
26 
27 namespace vmime {
28 
29 
30 //
31 // exception
32 //
33 
34 const exception exception::NO_EXCEPTION;
35 
36 
exception()37 exception::exception()
38 	: std::runtime_error(""), m_other(NULL)
39 {
40 }
41 
42 
exception(const string & what,const exception & other)43 exception::exception(const string& what, const exception& other)
44 	: std::runtime_error(what), m_other(&other != &NO_EXCEPTION ? other.clone() : NULL)
45 {
46 }
47 
48 
exception(const exception & e)49 exception::exception(const exception& e)
50 	: std::runtime_error(e.what()), m_other(e.m_other == NULL ? NULL : e.m_other->clone())
51 {
52 }
53 
54 
~exception()55 exception::~exception() throw()
56 {
57 	delete (m_other);
58 }
59 
60 
chainException(const exception & other)61 void exception::chainException(const exception& other)
62 {
63 	exception* e = other.clone();
64 
65 	delete m_other;
66 	m_other = e;
67 }
68 
69 
other() const70 const exception* exception::other() const throw()
71 {
72 	return (m_other);
73 }
74 
75 
name() const76 const char* exception::name() const throw()
77 {
78 	return "exception";
79 }
80 
81 
clone() const82 exception* exception::clone() const
83 {
84 	return new exception(*this);
85 }
86 
87 
88 
89 namespace exceptions
90 {
91 
92 
93 //
94 // bad_field_value_type
95 //
96 
~bad_field_value_type()97 bad_field_value_type::~bad_field_value_type() throw() {}
bad_field_value_type(const string & fieldName,const exception & other)98 bad_field_value_type::bad_field_value_type(const string& fieldName, const exception& other)
99 	: exception("Bad value type for field '" + fieldName + "'.", other) {}
100 
clone() const101 exception* bad_field_value_type::clone() const { return new bad_field_value_type(*this); }
name() const102 const char* bad_field_value_type::name() const throw() { return "bad_field_value_type"; }
103 
104 
105 
106 //
107 // charset_conv_error
108 //
109 
~charset_conv_error()110 charset_conv_error::~charset_conv_error() throw() {}
charset_conv_error(const string & what,const exception & other)111 charset_conv_error::charset_conv_error(const string& what, const exception& other)
112 	: exception(what.empty() ? "Charset conversion error." : what, other) {}
113 
clone() const114 exception* charset_conv_error::clone() const { return new charset_conv_error(*this); }
name() const115 const char* charset_conv_error::name() const throw() { return "charset_conv_error"; }
116 
117 
118 
119 //
120 // illegal_byte_sequence_for_charset
121 //
122 
~illegal_byte_sequence_for_charset()123 illegal_byte_sequence_for_charset::~illegal_byte_sequence_for_charset() throw() {}
illegal_byte_sequence_for_charset(const string & what,const exception & other)124 illegal_byte_sequence_for_charset::illegal_byte_sequence_for_charset(const string& what, const exception& other)
125 	: exception(what.empty() ? "Found illegal byte sequence for this charset." : what, other) {}
126 
clone() const127 exception* illegal_byte_sequence_for_charset::clone() const { return new illegal_byte_sequence_for_charset(*this); }
name() const128 const char* illegal_byte_sequence_for_charset::name() const throw() { return "illegal_byte_sequence_for_charset"; }
129 
130 
131 
132 //
133 // no_encoder_available
134 //
135 
~no_encoder_available()136 no_encoder_available::~no_encoder_available() throw() {}
no_encoder_available(const string & name,const exception & other)137 no_encoder_available::no_encoder_available(const string& name, const exception& other)
138 	: exception("No encoder available: '" + name + "'.", other) {}
139 
clone() const140 exception* no_encoder_available::clone() const { return new no_encoder_available(*this); }
name() const141 const char* no_encoder_available::name() const throw() { return "no_encoder_available"; }
142 
143 
144 //
145 // no_digest_algorithm_available
146 //
147 
~no_digest_algorithm_available()148 no_digest_algorithm_available::~no_digest_algorithm_available() throw() {}
no_digest_algorithm_available(const string & name,const exception & other)149 no_digest_algorithm_available::no_digest_algorithm_available(const string& name, const exception& other)
150 	: exception("No algorithm available: '" + name + "'.", other) {}
151 
clone() const152 exception* no_digest_algorithm_available::clone() const { return new no_digest_algorithm_available(*this); }
name() const153 const char* no_digest_algorithm_available::name() const throw() { return "no_digest_algorithm_available"; }
154 
155 
156 //
157 // no_such_field
158 //
159 
~no_such_field()160 no_such_field::~no_such_field() throw() {}
no_such_field(const exception & other)161 no_such_field::no_such_field(const exception& other)
162 	: exception("Field not found.", other) {}
163 
clone() const164 exception* no_such_field::clone() const { return new no_such_field(*this); }
name() const165 const char* no_such_field::name() const throw() { return "no_such_field"; }
166 
167 
168 //
169 // no_such_part
170 //
171 
~no_such_part()172 no_such_part::~no_such_part() throw() {}
no_such_part(const exception & other)173 no_such_part::no_such_part(const exception& other)
174 	: exception("Part not found.", other) {}
175 
clone() const176 exception* no_such_part::clone() const { return new no_such_part(*this); }
name() const177 const char* no_such_part::name() const throw() { return "no_such_part"; }
178 
179 
180 //
181 // no_such_message_id
182 //
183 
~no_such_message_id()184 no_such_message_id::~no_such_message_id() throw() {}
no_such_message_id(const exception & other)185 no_such_message_id::no_such_message_id(const exception& other)
186 	: exception("Message-Id not found.", other) {}
187 
clone() const188 exception* no_such_message_id::clone() const { return new no_such_message_id(*this); }
name() const189 const char* no_such_message_id::name() const throw() { return "no_such_message_id"; }
190 
191 
192 //
193 // open_file_error
194 //
195 
~open_file_error()196 open_file_error::~open_file_error() throw() {}
open_file_error(const exception & other)197 open_file_error::open_file_error(const exception& other)
198 	: exception("Error opening file.", other) {}
199 
clone() const200 exception* open_file_error::clone() const { return new open_file_error(*this); }
name() const201 const char* open_file_error::name() const throw() { return "open_file_error"; }
202 
203 
204 //
205 // no_factory_available
206 //
207 
~no_factory_available()208 no_factory_available::~no_factory_available() throw() {}
no_factory_available(const exception & other)209 no_factory_available::no_factory_available(const exception& other)
210 	: exception("No factory available.", other) {}
211 
clone() const212 exception* no_factory_available::clone() const { return new no_factory_available(*this); }
name() const213 const char* no_factory_available::name() const throw() { return "no_factory_available"; }
214 
215 
216 //
217 // no_platform_handler
218 //
219 
~no_platform_handler()220 no_platform_handler::~no_platform_handler() throw() {}
no_platform_handler(const exception & other)221 no_platform_handler::no_platform_handler(const exception& other)
222 	: exception("No platform handler installed.", other) {}
223 
clone() const224 exception* no_platform_handler::clone() const { return new no_platform_handler(*this); }
name() const225 const char* no_platform_handler::name() const throw() { return "no_platform_handler"; }
226 
227 
228 //
229 // no_expeditor
230 //
231 
~no_expeditor()232 no_expeditor::~no_expeditor() throw() {}
no_expeditor(const exception & other)233 no_expeditor::no_expeditor(const exception& other)
234 	: exception("No expeditor specified.", other) {}
235 
clone() const236 exception* no_expeditor::clone() const { return new no_expeditor(*this); }
name() const237 const char* no_expeditor::name() const throw() { return "no_expeditor"; }
238 
239 
240 //
241 // no_recipient
242 //
243 
~no_recipient()244 no_recipient::~no_recipient() throw() {}
no_recipient(const exception & other)245 no_recipient::no_recipient(const exception& other)
246 	: exception("No recipient specified.", other) {}
247 
clone() const248 exception* no_recipient::clone() const { return new no_recipient(*this); }
name() const249 const char* no_recipient::name() const throw() { return "no_recipient"; }
250 
251 
252 //
253 // no_such_property
254 //
255 
~no_such_property()256 no_such_property::~no_such_property() throw() {}
no_such_property(const string & name,const exception & other)257 no_such_property::no_such_property(const string& name, const exception& other)
258 	: exception(string("No such property: '") + name + string("'."), other) { }
259 
clone() const260 exception* no_such_property::clone() const { return new no_such_property(*this); }
name() const261 const char* no_such_property::name() const throw() { return "no_such_property"; }
262 
263 
264 //
265 // invalid_property_type
266 //
267 
~invalid_property_type()268 invalid_property_type::~invalid_property_type() throw() {}
invalid_property_type(const exception & other)269 invalid_property_type::invalid_property_type(const exception& other)
270 	: exception("Invalid property type.", other) {}
271 
clone() const272 exception* invalid_property_type::clone() const { return new invalid_property_type(*this); }
name() const273 const char* invalid_property_type::name() const throw() { return "invalid_property_type"; }
274 
275 
276 //
277 // invalid_argument
278 //
279 
~invalid_argument()280 invalid_argument::~invalid_argument() throw() {}
invalid_argument(const exception & other)281 invalid_argument::invalid_argument(const exception& other)
282 	: exception("Invalid argument.", other) {}
283 
clone() const284 exception* invalid_argument::clone() const { return new invalid_argument(*this); }
name() const285 const char* invalid_argument::name() const throw() { return "invalid_argument"; }
286 
287 
288 //
289 // system_error
290 //
291 
~system_error()292 system_error::~system_error() throw() { }
system_error(const string & what,const exception & other)293 system_error::system_error(const string& what, const exception& other)
294 	: exception(what, other) {}
295 
clone() const296 exception* system_error::clone() const { return new system_error(*this); }
name() const297 const char* system_error::name() const throw() { return "system_error"; }
298 
299 
300 //
301 // malformed_url
302 //
303 
~malformed_url()304 malformed_url::~malformed_url() throw() {}
malformed_url(const string & error,const exception & other)305 malformed_url::malformed_url(const string& error, const exception& other)
306 	: exception("Malformed URL: " + error + ".", other) {}
307 
clone() const308 exception* malformed_url::clone() const { return new malformed_url(*this); }
name() const309 const char* malformed_url::name() const throw() { return "malformed_url"; }
310 
311 
312 
313 #if VMIME_HAVE_MESSAGING_FEATURES
314 
315 
316 //
317 // net_exception
318 //
319 
~net_exception()320 net_exception::~net_exception() throw() {}
net_exception(const string & what,const exception & other)321 net_exception::net_exception(const string& what, const exception& other)
322 	: exception(what, other) {}
323 
clone() const324 exception* net_exception::clone() const { return new net_exception(*this); }
name() const325 const char* net_exception::name() const throw() { return "net_exception"; }
326 
327 
328 //
329 // socket_exception
330 //
331 
~socket_exception()332 socket_exception::~socket_exception() throw() {}
socket_exception(const string & what,const exception & other)333 socket_exception::socket_exception(const string& what, const exception& other)
334 	: net_exception(what.empty()
335 		? "Socket error." : what, other) {}
336 
clone() const337 exception* socket_exception::clone() const { return new socket_exception(*this); }
name() const338 const char* socket_exception::name() const throw() { return "socket_exception"; }
339 
340 
341 //
342 // socket_not_connected_exception
343 //
344 
~socket_not_connected_exception()345 socket_not_connected_exception::~socket_not_connected_exception() throw() {}
socket_not_connected_exception(const string & what,const exception & other)346 socket_not_connected_exception::socket_not_connected_exception(const string& what, const exception& other)
347 	: socket_exception(what.empty()
348 		? "Socket is not connected." : what, other) {}
349 
clone() const350 exception* socket_not_connected_exception::clone() const { return new socket_not_connected_exception(*this); }
name() const351 const char* socket_not_connected_exception::name() const throw() { return "socket_not_connected_exception"; }
352 
353 
354 //
355 // connection_error
356 //
357 
~connection_error()358 connection_error::~connection_error() throw() {}
connection_error(const string & what,const exception & other)359 connection_error::connection_error(const string& what, const exception& other)
360 	: socket_exception(what.empty()
361 		? "Connection error." : what, other) {}
362 
clone() const363 exception* connection_error::clone() const { return new connection_error(*this); }
name() const364 const char* connection_error::name() const throw() { return "connection_error"; }
365 
366 
367 //
368 // connection_greeting_error
369 //
370 
~connection_greeting_error()371 connection_greeting_error::~connection_greeting_error() throw() {}
connection_greeting_error(const string & response,const exception & other)372 connection_greeting_error::connection_greeting_error(const string& response, const exception& other)
373 	: net_exception("Greeting error.", other), m_response(response) {}
374 
response() const375 const string& connection_greeting_error::response() const { return (m_response); }
376 
clone() const377 exception* connection_greeting_error::clone() const { return new connection_greeting_error(*this); }
name() const378 const char* connection_greeting_error::name() const throw() { return "connection_greeting_error"; }
379 
380 
381 //
382 // authentication_error
383 //
384 
~authentication_error()385 authentication_error::~authentication_error() throw() {}
authentication_error(const string & response,const exception & other)386 authentication_error::authentication_error(const string& response, const exception& other)
387 	: net_exception("Authentication error.", other), m_response(response) {}
388 
response() const389 const string& authentication_error::response() const { return (m_response); }
390 
clone() const391 exception* authentication_error::clone() const { return new authentication_error(*this); }
name() const392 const char* authentication_error::name() const throw() { return "authentication_error"; }
393 
394 
395 //
396 // unsupported_option
397 //
398 
~unsupported_option()399 unsupported_option::~unsupported_option() throw() {}
unsupported_option(const exception & other)400 unsupported_option::unsupported_option(const exception& other)
401 	: net_exception("Unsupported option.", other) {}
402 
clone() const403 exception* unsupported_option::clone() const { return new unsupported_option(*this); }
name() const404 const char* unsupported_option::name() const throw() { return "unsupported_option"; }
405 
406 
407 //
408 // illegal_state
409 //
410 
~illegal_state()411 illegal_state::~illegal_state() throw() {}
illegal_state(const string & state,const exception & other)412 illegal_state::illegal_state(const string& state, const exception& other)
413 	: net_exception("Illegal state to accomplish the operation: '" + state + "'.", other) {}
414 
clone() const415 exception* illegal_state::clone() const { return new illegal_state(*this); }
name() const416 const char* illegal_state::name() const throw() { return "illegal_state"; }
417 
418 
419 //
420 // folder_not_found
421 //
422 
~folder_not_found()423 folder_not_found::~folder_not_found() throw() {}
folder_not_found(const exception & other)424 folder_not_found::folder_not_found(const exception& other)
425 	: net_exception("Folder not found.", other) {}
426 
clone() const427 exception* folder_not_found::clone() const { return new folder_not_found(*this); }
name() const428 const char* folder_not_found::name() const throw() { return "folder_not_found"; }
429 
430 
431 //
432 // folder_already_open
433 //
434 
~folder_already_open()435 folder_already_open::~folder_already_open() throw() {}
folder_already_open(const exception & other)436 folder_already_open::folder_already_open(const exception& other)
437 	: net_exception("Folder is already open in the same session.", other) {}
438 
clone() const439 exception* folder_already_open::clone() const { return new folder_already_open(*this); }
name() const440 const char* folder_already_open::name() const throw() { return "folder_already_open"; }
441 
442 
443 //
444 // message_not_found
445 //
446 
~message_not_found()447 message_not_found::~message_not_found() throw() {}
message_not_found(const exception & other)448 message_not_found::message_not_found(const exception& other)
449 	: net_exception("Message not found.", other) {}
450 
clone() const451 exception* message_not_found::clone() const { return new message_not_found(*this); }
name() const452 const char* message_not_found::name() const throw() { return "message_not_found"; }
453 
454 
455 //
456 // operation_not_supported
457 //
458 
~operation_not_supported()459 operation_not_supported::~operation_not_supported() throw() {}
operation_not_supported(const exception & other)460 operation_not_supported::operation_not_supported(const exception& other)
461 	: net_exception("Operation not supported.", other) {}
462 
clone() const463 exception* operation_not_supported::clone() const { return new operation_not_supported(*this); }
name() const464 const char* operation_not_supported::name() const throw() { return "operation_not_supported"; }
465 
466 
467 //
468 // operation_timed_out
469 //
470 
~operation_timed_out()471 operation_timed_out::~operation_timed_out() throw() {}
operation_timed_out(const exception & other)472 operation_timed_out::operation_timed_out(const exception& other)
473 	: net_exception("Operation timed out.", other) {}
474 
clone() const475 exception* operation_timed_out::clone() const { return new operation_timed_out(*this); }
name() const476 const char* operation_timed_out::name() const throw() { return "operation_timed_out"; }
477 
478 
479 //
480 // operation_cancelled
481 //
482 
~operation_cancelled()483 operation_cancelled::~operation_cancelled() throw() {}
operation_cancelled(const exception & other)484 operation_cancelled::operation_cancelled(const exception& other)
485 	: net_exception("Operation cancelled by the user.", other) {}
486 
clone() const487 exception* operation_cancelled::clone() const { return new operation_cancelled(*this); }
name() const488 const char* operation_cancelled::name() const throw() { return "operation_cancelled"; }
489 
490 
491 //
492 // unfetched_object
493 //
494 
~unfetched_object()495 unfetched_object::~unfetched_object() throw() {}
unfetched_object(const exception & other)496 unfetched_object::unfetched_object(const exception& other)
497 	: net_exception("Object not fetched.", other) {}
498 
clone() const499 exception* unfetched_object::clone() const { return new unfetched_object(*this); }
name() const500 const char* unfetched_object::name() const throw() { return "unfetched_object"; }
501 
502 
503 //
504 // not_connected
505 //
506 
~not_connected()507 not_connected::~not_connected() throw() {}
not_connected(const exception & other)508 not_connected::not_connected(const exception& other)
509 	: net_exception("Not connected to a service.", other) {}
510 
clone() const511 exception* not_connected::clone() const { return new not_connected(*this); }
name() const512 const char* not_connected::name() const throw() { return "not_connected"; }
513 
514 
515 //
516 // already_connected
517 //
518 
~already_connected()519 already_connected::~already_connected() throw() {}
already_connected(const exception & other)520 already_connected::already_connected(const exception& other)
521 	: net_exception("Already connected to a service. Disconnect and retry.", other) {}
522 
clone() const523 exception* already_connected::clone() const { return new already_connected(*this); }
name() const524 const char* already_connected::name() const throw() { return "already_connected"; }
525 
526 
527 //
528 // illegal_operation
529 //
530 
~illegal_operation()531 illegal_operation::~illegal_operation() throw() {}
illegal_operation(const string & msg,const exception & other)532 illegal_operation::illegal_operation(const string& msg, const exception& other)
533 	: net_exception(msg.empty()
534 		? "Illegal operation."
535 		: "Illegal operation: " + msg + ".",
536 		other
537 	) {}
538 
clone() const539 exception* illegal_operation::clone() const { return new illegal_operation(*this); }
name() const540 const char* illegal_operation::name() const throw() { return "illegal_operation"; }
541 
542 
543 //
544 // command_error
545 //
546 
~command_error()547 command_error::~command_error() throw() {}
command_error(const string & command,const string & response,const string & desc,const exception & other)548 command_error::command_error(const string& command, const string& response,
549                              const string& desc, const exception& other)
550 	: net_exception(desc.empty()
551 		? "Error while executing command '" + command + "'."
552 		: "Error while executing command '" + command + "': " + desc + ".",
553 		other
554 	),
555 	m_command(command), m_response(response) {}
556 
command() const557 const string& command_error::command() const { return (m_command); }
558 
response() const559 const string& command_error::response() const { return (m_response); }
560 
clone() const561 exception* command_error::clone() const { return new command_error(*this); }
name() const562 const char* command_error::name() const throw() { return "command_error"; }
563 
564 
565 //
566 // invalid_response
567 //
568 
~invalid_response()569 invalid_response::~invalid_response() throw() {}
invalid_response(const string & command,const string & response,const exception & other)570 invalid_response::invalid_response(const string& command, const string& response, const exception& other)
571 	: net_exception(command.empty()
572 		? "Received invalid response."
573 		: "Received invalid response for command '" + command + "'.",
574 		other
575 	),
576 	m_command(command), m_response(response) {}
577 
command() const578 const string& invalid_response::command() const { return (m_command); }
579 
response() const580 const string& invalid_response::response() const { return (m_response); }
581 
clone() const582 exception* invalid_response::clone() const { return new invalid_response(*this); }
name() const583 const char* invalid_response::name() const throw() { return "invalid_response"; }
584 
585 
586 //
587 // partial_fetch_not_supported
588 //
589 
~partial_fetch_not_supported()590 partial_fetch_not_supported::~partial_fetch_not_supported() throw() {}
partial_fetch_not_supported(const exception & other)591 partial_fetch_not_supported::partial_fetch_not_supported(const exception& other)
592 	: net_exception("Partial fetch not supported.", other) {}
593 
clone() const594 exception* partial_fetch_not_supported::clone() const { return new partial_fetch_not_supported(*this); }
name() const595 const char* partial_fetch_not_supported::name() const throw() { return "partial_fetch_not_supported"; }
596 
597 
598 //
599 // invalid_folder_name
600 //
601 
~invalid_folder_name()602 invalid_folder_name::~invalid_folder_name() throw() {}
invalid_folder_name(const string & error,const exception & other)603 invalid_folder_name::invalid_folder_name(const string& error, const exception& other)
604 	: net_exception(error.empty()
605 		? "Invalid folder name: " + error + "."
606 		: "Invalid folder name.",
607 		other) {}
608 
clone() const609 exception* invalid_folder_name::clone() const { return new invalid_folder_name(*this); }
name() const610 const char* invalid_folder_name::name() const throw() { return "invalid_folder_name"; }
611 
612 
613 #endif // VMIME_HAVE_MESSAGING_FEATURES
614 
615 
616 #if VMIME_HAVE_FILESYSTEM_FEATURES
617 
618 
619 //
620 // filesystem_exception
621 //
622 
~filesystem_exception()623 filesystem_exception::~filesystem_exception() throw() {}
filesystem_exception(const string & what,const utility::path & path,const exception & other)624 filesystem_exception::filesystem_exception(const string& what, const utility::path& path, const exception& other)
625 	: exception(what, other), m_path(path) {}
626 
path() const627 const utility::path& filesystem_exception::path() const { return (m_path); }
628 
clone() const629 exception* filesystem_exception::clone() const { return new filesystem_exception(*this); }
name() const630 const char* filesystem_exception::name() const throw() { return "filesystem_exception"; }
631 
632 
633 //
634 // not_a_directory
635 //
636 
~not_a_directory()637 not_a_directory::~not_a_directory() throw() {}
not_a_directory(const utility::path & path,const exception & other)638 not_a_directory::not_a_directory(const utility::path& path, const exception& other)
639 	: filesystem_exception("Operation failed: this is not a directory.", path, other) {}
640 
clone() const641 exception* not_a_directory::clone() const { return new not_a_directory(*this); }
name() const642 const char* not_a_directory::name() const throw() { return "not_a_directory"; }
643 
644 
645 //
646 // file_not_found
647 //
648 
~file_not_found()649 file_not_found::~file_not_found() throw() {}
file_not_found(const utility::path & path,const exception & other)650 file_not_found::file_not_found(const utility::path& path, const exception& other)
651 	: filesystem_exception("File not found.", path, other) {}
652 
clone() const653 exception* file_not_found::clone() const { return new file_not_found(*this); }
name() const654 const char* file_not_found::name() const throw() { return "file_not_found"; }
655 
656 
657 #endif // VMIME_HAVE_FILESYSTEM_FEATURES
658 
659 
660 //
661 // authentication_exception
662 //
663 
~authentication_exception()664 authentication_exception::~authentication_exception() throw() {}
authentication_exception(const string & what,const exception & other)665 authentication_exception::authentication_exception(const string& what, const exception& other)
666 	: exception(what, other) {}
667 
clone() const668 exception* authentication_exception::clone() const { return new authentication_exception(*this); }
name() const669 const char* authentication_exception::name() const throw() { return "authentication_exception"; }
670 
671 
672 //
673 // no_auth_information
674 //
675 
~no_auth_information()676 no_auth_information::~no_auth_information() throw() {}
no_auth_information(const exception & other)677 no_auth_information::no_auth_information(const exception& other)
678 	: authentication_exception("Information cannot be provided.", other) {}
679 
clone() const680 exception* no_auth_information::clone() const { return new no_auth_information(*this); }
name() const681 const char* no_auth_information::name() const throw() { return "no_auth_information"; }
682 
683 
684 #if VMIME_HAVE_SASL_SUPPORT
685 
686 
687 //
688 // sasl_exception
689 //
690 
~sasl_exception()691 sasl_exception::~sasl_exception() throw() {}
sasl_exception(const string & what,const exception & other)692 sasl_exception::sasl_exception(const string& what, const exception& other)
693 	: authentication_exception(what, other) {}
694 
clone() const695 exception* sasl_exception::clone() const { return new sasl_exception(*this); }
name() const696 const char* sasl_exception::name() const throw() { return "sasl_exception"; }
697 
698 
699 //
700 // no_such_mechanism
701 //
702 
~no_such_mechanism()703 no_such_mechanism::~no_such_mechanism() throw() {}
no_such_mechanism(const string & name,const exception & other)704 no_such_mechanism::no_such_mechanism(const string& name, const exception& other)
705 	: sasl_exception("No such SASL mechanism: '" + name + "'.", other) {}
706 
clone() const707 exception* no_such_mechanism::clone() const { return new no_such_mechanism(*this); }
name() const708 const char* no_such_mechanism::name() const throw() { return "no_such_mechanism"; }
709 
710 
711 #endif // VMIME_HAVE_SASL_SUPPORT
712 
713 
714 #if VMIME_HAVE_TLS_SUPPORT
715 
716 
717 //
718 // tls_exception
719 //
720 
~tls_exception()721 tls_exception::~tls_exception() throw() {}
tls_exception(const string & what,const exception & other)722 tls_exception::tls_exception(const string& what, const exception& other)
723 	: exception(what, other) {}
724 
clone() const725 exception* tls_exception::clone() const { return new tls_exception(*this); }
name() const726 const char* tls_exception::name() const throw() { return "tls_exception"; }
727 
728 
729 #endif // VMIME_HAVE_TLS_SUPPORT
730 
731 
732 } // exceptions
733 
734 
735 } // vmime
736 
737