From 3b97064d40e93c26bdf895c52bedb2f58dda0406 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 4 Jan 2005 22:03:16 +0000 Subject: Added diagnostic error string for 'exceptions::connection_error' + fixed a bug in 'posixSocket::connect()' when specifying an IP address. --- src/platforms/posix/posixSocket.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/platforms') 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 (&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 (&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."); } } -- cgit