aboutsummaryrefslogtreecommitdiffstats
path: root/src/exception.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-08-19 18:45:40 +0000
committerVincent Richard <[email protected]>2005-08-19 18:45:40 +0000
commit4f88d29dc0e0887431f0fb844d7b0df0e300d6a0 (patch)
tree64f04580b2c931d909454cb027d5b16f99547bc6 /src/exception.cpp
parentContent handler constness. (diff)
downloadvmime-4f88d29dc0e0887431f0fb844d7b0df0e300d6a0.tar.gz
vmime-4f88d29dc0e0887431f0fb844d7b0df0e300d6a0.zip
vmime::exception now inherits from std::exception.
Diffstat (limited to 'src/exception.cpp')
-rw-r--r--src/exception.cpp102
1 files changed, 54 insertions, 48 deletions
diff --git a/src/exception.cpp b/src/exception.cpp
index bac5c728..957b126c 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -42,25 +42,31 @@ exception::exception(const string& what, const exception& other)
}
-exception::~exception()
+exception::~exception() throw()
{
delete (m_other);
}
-const string exception::what() const throw()
+const char* exception::what() const throw()
{
- return (m_what);
+ return (m_what.c_str());
}
-const exception* exception::other() const
+const char* exception::what() throw()
+{
+ return (m_what.c_str());
+}
+
+
+const exception* exception::other() const throw()
{
return (m_other);
}
-const string exception::name() const
+const char* exception::name() const throw()
{
return "exception";
}
@@ -86,7 +92,7 @@ bad_field_type::bad_field_type(const exception& other)
: exception("Bad field type.", other) {}
exception* bad_field_type::clone() const { return new bad_field_type(*this); }
-const string bad_field_type::name() const { return "bad_field_type"; }
+const char* bad_field_type::name() const throw() { return "bad_field_type"; }
@@ -99,7 +105,7 @@ charset_conv_error::charset_conv_error(const exception& other)
: exception("Charset conversion error.", other) {}
exception* charset_conv_error::clone() const { return new charset_conv_error(*this); }
-const string charset_conv_error::name() const { return "charset_conv_error"; }
+const char* charset_conv_error::name() const throw() { return "charset_conv_error"; }
//
@@ -111,7 +117,7 @@ no_encoder_available::no_encoder_available(const exception& other)
: exception("No encoder available.", other) {}
exception* no_encoder_available::clone() const { return new no_encoder_available(*this); }
-const string no_encoder_available::name() const { return "no_encoder_available"; }
+const char* no_encoder_available::name() const throw() { return "no_encoder_available"; }
//
@@ -123,7 +129,7 @@ no_such_parameter::no_such_parameter(const string& name, const exception& other)
: exception(string("Parameter not found: '") + name + string("'."), other) {}
exception* no_such_parameter::clone() const { return new no_such_parameter(*this); }
-const string no_such_parameter::name() const { return "no_such_parameter"; }
+const char* no_such_parameter::name() const throw() { return "no_such_parameter"; }
//
@@ -135,7 +141,7 @@ no_such_field::no_such_field(const exception& other)
: exception("Field not found.", other) {}
exception* no_such_field::clone() const { return new no_such_field(*this); }
-const string no_such_field::name() const { return "no_such_field"; }
+const char* no_such_field::name() const throw() { return "no_such_field"; }
//
@@ -147,7 +153,7 @@ no_such_part::no_such_part(const exception& other)
: exception("Part not found.", other) {}
exception* no_such_part::clone() const { return new no_such_part(*this); }
-const string no_such_part::name() const { return "no_such_part"; }
+const char* no_such_part::name() const throw() { return "no_such_part"; }
//
@@ -159,7 +165,7 @@ no_such_mailbox::no_such_mailbox(const exception& other)
: exception("Mailbox not found.", other) {}
exception* no_such_mailbox::clone() const { return new no_such_mailbox(*this); }
-const string no_such_mailbox::name() const { return "no_such_mailbox"; }
+const char* no_such_mailbox::name() const throw() { return "no_such_mailbox"; }
//
@@ -171,7 +177,7 @@ no_such_message_id::no_such_message_id(const exception& other)
: exception("Message-Id not found.", other) {}
exception* no_such_message_id::clone() const { return new no_such_message_id(*this); }
-const string no_such_message_id::name() const { return "no_such_message_id"; }
+const char* no_such_message_id::name() const throw() { return "no_such_message_id"; }
//
@@ -183,7 +189,7 @@ no_such_address::no_such_address(const exception& other)
: exception("Address not found.", other) {}
exception* no_such_address::clone() const { return new no_such_address(*this); }
-const string no_such_address::name() const { return "no_such_address"; }
+const char* no_such_address::name() const throw() { return "no_such_address"; }
//
@@ -195,7 +201,7 @@ open_file_error::open_file_error(const exception& other)
: exception("Error opening file.", other) {}
exception* open_file_error::clone() const { return new open_file_error(*this); }
-const string open_file_error::name() const { return "open_file_error"; }
+const char* open_file_error::name() const throw() { return "open_file_error"; }
//
@@ -207,7 +213,7 @@ no_factory_available::no_factory_available(const exception& other)
: exception("No factory available.", other) {}
exception* no_factory_available::clone() const { return new no_factory_available(*this); }
-const string no_factory_available::name() const { return "no_factory_available"; }
+const char* no_factory_available::name() const throw() { return "no_factory_available"; }
//
@@ -219,7 +225,7 @@ no_platform_dependant_handler::no_platform_dependant_handler(const exception& ot
: exception("No platform-dependant handler installed.", other) {}
exception* no_platform_dependant_handler::clone() const { return new no_platform_dependant_handler(*this); }
-const string no_platform_dependant_handler::name() const { return "no_platform_dependant_handler"; }
+const char* no_platform_dependant_handler::name() const throw() { return "no_platform_dependant_handler"; }
//
@@ -231,7 +237,7 @@ no_expeditor::no_expeditor(const exception& other)
: exception("No expeditor specified.", other) {}
exception* no_expeditor::clone() const { return new no_expeditor(*this); }
-const string no_expeditor::name() const { return "no_expeditor"; }
+const char* no_expeditor::name() const throw() { return "no_expeditor"; }
//
@@ -243,7 +249,7 @@ no_recipient::no_recipient(const exception& other)
: exception("No recipient specified.", other) {}
exception* no_recipient::clone() const { return new no_recipient(*this); }
-const string no_recipient::name() const { return "no_recipient"; }
+const char* no_recipient::name() const throw() { return "no_recipient"; }
//
@@ -255,7 +261,7 @@ no_object_found::no_object_found(const exception& other)
: exception("No object found.", other) {}
exception* no_object_found::clone() const { return new no_object_found(*this); }
-const string no_object_found::name() const { return "no_object_found"; }
+const char* no_object_found::name() const throw() { return "no_object_found"; }
//
@@ -267,7 +273,7 @@ no_such_property::no_such_property(const string& name, const exception& other)
: exception(std::string("No such property: '") + name + string("'."), other) { }
exception* no_such_property::clone() const { return new no_such_property(*this); }
-const string no_such_property::name() const { return "no_such_property"; }
+const char* no_such_property::name() const throw() { return "no_such_property"; }
//
@@ -279,7 +285,7 @@ invalid_property_type::invalid_property_type(const exception& other)
: exception("Invalid property type.", other) {}
exception* invalid_property_type::clone() const { return new invalid_property_type(*this); }
-const string invalid_property_type::name() const { return "invalid_property_type"; }
+const char* invalid_property_type::name() const throw() { return "invalid_property_type"; }
//
@@ -291,7 +297,7 @@ invalid_argument::invalid_argument(const exception& other)
: exception("Invalid argument.", other) {}
exception* invalid_argument::clone() const { return new invalid_argument(*this); }
-const string invalid_argument::name() const { return "invalid_argument"; }
+const char* invalid_argument::name() const throw() { return "invalid_argument"; }
//
@@ -303,7 +309,7 @@ system_error::system_error(const string& what, const exception& other)
: exception(what, other) {}
exception* system_error::clone() const { return new system_error(*this); }
-const string system_error::name() const { return "system_error"; }
+const char* system_error::name() const throw() { return "system_error"; }
@@ -319,7 +325,7 @@ messaging_exception::messaging_exception(const string& what, const exception& ot
: exception(what, other) {}
exception* messaging_exception::clone() const { return new messaging_exception(*this); }
-const string messaging_exception::name() const { return "messaging_exception"; }
+const char* messaging_exception::name() const throw() { return "messaging_exception"; }
//
@@ -333,7 +339,7 @@ connection_error::connection_error(const string& what, const exception& other)
: "Connection error: '" + what + "'.", other) {}
exception* connection_error::clone() const { return new connection_error(*this); }
-const string connection_error::name() const { return "connection_error"; }
+const char* connection_error::name() const throw() { return "connection_error"; }
//
@@ -347,7 +353,7 @@ connection_greeting_error::connection_greeting_error(const string& response, con
const string& connection_greeting_error::response() const { return (m_response); }
exception* connection_greeting_error::clone() const { return new connection_greeting_error(*this); }
-const string connection_greeting_error::name() const { return "connection_greeting_error"; }
+const char* connection_greeting_error::name() const throw() { return "connection_greeting_error"; }
//
@@ -361,7 +367,7 @@ authentication_error::authentication_error(const string& response, const excepti
const string& authentication_error::response() const { return (m_response); }
exception* authentication_error::clone() const { return new authentication_error(*this); }
-const string authentication_error::name() const { return "authentication_error"; }
+const char* authentication_error::name() const throw() { return "authentication_error"; }
//
@@ -373,7 +379,7 @@ unsupported_option::unsupported_option(const exception& other)
: messaging_exception("Unsupported option.", other) {}
exception* unsupported_option::clone() const { return new unsupported_option(*this); }
-const string unsupported_option::name() const { return "unsupported_option"; }
+const char* unsupported_option::name() const throw() { return "unsupported_option"; }
//
@@ -387,7 +393,7 @@ no_service_available::no_service_available(const string& proto, const exception&
: "No service available for this protocol: '" + proto + "'.", other) {}
exception* no_service_available::clone() const { return new no_service_available(*this); }
-const string no_service_available::name() const { return "no_service_available"; }
+const char* no_service_available::name() const throw() { return "no_service_available"; }
//
@@ -399,7 +405,7 @@ illegal_state::illegal_state(const string& state, const exception& other)
: messaging_exception("Illegal state to accomplish the operation: '" + state + "'.", other) {}
exception* illegal_state::clone() const { return new illegal_state(*this); }
-const string illegal_state::name() const { return "illegal_state"; }
+const char* illegal_state::name() const throw() { return "illegal_state"; }
//
@@ -411,7 +417,7 @@ folder_not_found::folder_not_found(const exception& other)
: messaging_exception("Folder not found.", other) {}
exception* folder_not_found::clone() const { return new folder_not_found(*this); }
-const string folder_not_found::name() const { return "folder_not_found"; }
+const char* folder_not_found::name() const throw() { return "folder_not_found"; }
//
@@ -423,7 +429,7 @@ message_not_found::message_not_found(const exception& other)
: messaging_exception("Message not found.", other) {}
exception* message_not_found::clone() const { return new message_not_found(*this); }
-const string message_not_found::name() const { return "message_not_found"; }
+const char* message_not_found::name() const throw() { return "message_not_found"; }
//
@@ -435,7 +441,7 @@ operation_not_supported::operation_not_supported(const exception& other)
: messaging_exception("Operation not supported.", other) {}
exception* operation_not_supported::clone() const { return new operation_not_supported(*this); }
-const string operation_not_supported::name() const { return "operation_not_supported"; }
+const char* operation_not_supported::name() const throw() { return "operation_not_supported"; }
//
@@ -447,7 +453,7 @@ operation_timed_out::operation_timed_out(const exception& other)
: messaging_exception("Operation timed out.", other) {}
exception* operation_timed_out::clone() const { return new operation_timed_out(*this); }
-const string operation_timed_out::name() const { return "operation_timed_out"; }
+const char* operation_timed_out::name() const throw() { return "operation_timed_out"; }
//
@@ -459,7 +465,7 @@ operation_cancelled::operation_cancelled(const exception& other)
: messaging_exception("Operation cancelled by the user.", other) {}
exception* operation_cancelled::clone() const { return new operation_cancelled(*this); }
-const string operation_cancelled::name() const { return "operation_cancelled"; }
+const char* operation_cancelled::name() const throw() { return "operation_cancelled"; }
//
@@ -471,7 +477,7 @@ unfetched_object::unfetched_object(const exception& other)
: messaging_exception("Object not fetched.", other) {}
exception* unfetched_object::clone() const { return new unfetched_object(*this); }
-const string unfetched_object::name() const { return "unfetched_object"; }
+const char* unfetched_object::name() const throw() { return "unfetched_object"; }
//
@@ -483,7 +489,7 @@ not_connected::not_connected(const exception& other)
: messaging_exception("Not connected to a service.", other) {}
exception* not_connected::clone() const { return new not_connected(*this); }
-const string not_connected::name() const { return "not_connected"; }
+const char* not_connected::name() const throw() { return "not_connected"; }
//
@@ -495,7 +501,7 @@ already_connected::already_connected(const exception& other)
: messaging_exception("Already connected to a service. Disconnect and retry.", other) {}
exception* already_connected::clone() const { return new already_connected(*this); }
-const string already_connected::name() const { return "already_connected"; }
+const char* already_connected::name() const throw() { return "already_connected"; }
//
@@ -511,7 +517,7 @@ illegal_operation::illegal_operation(const string& msg, const exception& other)
) {}
exception* illegal_operation::clone() const { return new illegal_operation(*this); }
-const string illegal_operation::name() const { return "illegal_operation"; }
+const char* illegal_operation::name() const throw() { return "illegal_operation"; }
//
@@ -533,7 +539,7 @@ const string& command_error::command() const { return (m_command); }
const string& command_error::response() const { return (m_response); }
exception* command_error::clone() const { return new command_error(*this); }
-const string command_error::name() const { return "command_error"; }
+const char* command_error::name() const throw() { return "command_error"; }
//
@@ -554,7 +560,7 @@ const string& invalid_response::command() const { return (m_command); }
const string& invalid_response::response() const { return (m_response); }
exception* invalid_response::clone() const { return new invalid_response(*this); }
-const string invalid_response::name() const { return "invalid_response"; }
+const char* invalid_response::name() const throw() { return "invalid_response"; }
//
@@ -566,7 +572,7 @@ partial_fetch_not_supported::partial_fetch_not_supported(const exception& other)
: messaging_exception("Partial fetch not supported.", other) {}
exception* partial_fetch_not_supported::clone() const { return new partial_fetch_not_supported(*this); }
-const string partial_fetch_not_supported::name() const { return "partial_fetch_not_supported"; }
+const char* partial_fetch_not_supported::name() const throw() { return "partial_fetch_not_supported"; }
//
@@ -578,7 +584,7 @@ malformed_url::malformed_url(const string& error, const exception& other)
: messaging_exception("Malformed URL: " + error + ".", other) {}
exception* malformed_url::clone() const { return new malformed_url(*this); }
-const string malformed_url::name() const { return "malformed_url"; }
+const char* malformed_url::name() const throw() { return "malformed_url"; }
//
@@ -593,7 +599,7 @@ invalid_folder_name::invalid_folder_name(const string& error, const exception& o
other) {}
exception* invalid_folder_name::clone() const { return new invalid_folder_name(*this); }
-const string invalid_folder_name::name() const { return "invalid_folder_name"; }
+const char* invalid_folder_name::name() const throw() { return "invalid_folder_name"; }
#endif // VMIME_HAVE_MESSAGING_FEATURES
@@ -613,7 +619,7 @@ filesystem_exception::filesystem_exception(const string& what, const utility::pa
const utility::path& filesystem_exception::path() const { return (m_path); }
exception* filesystem_exception::clone() const { return new filesystem_exception(*this); }
-const string filesystem_exception::name() const { return "filesystem_exception"; }
+const char* filesystem_exception::name() const throw() { return "filesystem_exception"; }
//
@@ -625,7 +631,7 @@ not_a_directory::not_a_directory(const utility::path& path, const exception& oth
: filesystem_exception("Operation failed: this is not a directory.", path, other) {}
exception* not_a_directory::clone() const { return new not_a_directory(*this); }
-const string not_a_directory::name() const { return "not_a_directory"; }
+const char* not_a_directory::name() const throw() { return "not_a_directory"; }
//
@@ -637,7 +643,7 @@ file_not_found::file_not_found(const utility::path& path, const exception& other
: filesystem_exception("File not found.", path, other) {}
exception* file_not_found::clone() const { return new file_not_found(*this); }
-const string file_not_found::name() const { return "file_not_found"; }
+const char* file_not_found::name() const throw() { return "file_not_found"; }
#endif // VMIME_HAVE_FILESYSTEM_FEATURES