diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/exception.cpp | 6 | ||||
-rw-r--r-- | src/messaging/maildirStore.cpp | 2 | ||||
-rw-r--r-- | src/platforms/posix/posixSocket.cpp | 11 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/exception.cpp b/src/exception.cpp index fcb53900..cbdc3f3d 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -303,8 +303,10 @@ const string messaging_exception::name() const { return "messaging_exception"; } // connection_error::~connection_error() throw() {} -connection_error::connection_error(const exception& other) - : messaging_exception("Connection error.", other) {} +connection_error::connection_error(const string& what, const exception& other) + : messaging_exception(what.empty() + ? "Connection error." + : "Connection error: '" + what + "'.", other) {} exception* connection_error::clone() const { return new connection_error(*this); } const string connection_error::name() const { return "connection_error"; } diff --git a/src/messaging/maildirStore.cpp b/src/messaging/maildirStore.cpp index 63a94971..1bb5ace2 100644 --- a/src/messaging/maildirStore.cpp +++ b/src/messaging/maildirStore.cpp @@ -121,7 +121,7 @@ void maildirStore::connect() } catch (exceptions::filesystem_exception& e) { - throw exceptions::connection_error(e); + throw exceptions::connection_error("Cannot create root directory.", e); } } diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp index 0318e553..39acf666 100644 --- a/src/platforms/posix/posixSocket.cpp +++ b/src/platforms/posix/posixSocket.cpp @@ -80,22 +80,17 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port if (hostInfo == NULL) { // Error: cannot resolve address - throw vmime::exceptions::connection_error(); + throw vmime::exceptions::connection_error("Cannot resolve address."); } bcopy(hostInfo->h_addr, reinterpret_cast <char*>(&addr.sin_addr), hostInfo->h_length); } - else - { - // Error: cannot resolve address - throw vmime::exceptions::connection_error(); - } // Get a new socket m_desc = ::socket(AF_INET, SOCK_STREAM, 0); if (m_desc == -1) - throw vmime::exceptions::connection_error(); + throw vmime::exceptions::connection_error("Error while creating socket."); // Start connection if (::connect(m_desc, reinterpret_cast <sockaddr*>(&addr), sizeof(addr)) == -1) @@ -104,7 +99,7 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port m_desc = -1; // Error - throw vmime::exceptions::connection_error(); + throw vmime::exceptions::connection_error("Error while connecting socket."); } } |