Added diagnostic error string for 'exceptions::connection_error' + fixed a bug in 'posixSocket::connect()' when specifying an IP address.
This commit is contained in:
parent
43eb1c3cd0
commit
3b97064d40
@ -2,6 +2,13 @@
|
||||
VERSION 0.6.2-cvs
|
||||
=================
|
||||
|
||||
2005-01-04 Vincent Richard <vincent@vincent-richard.net>
|
||||
|
||||
* Added diagnostic error string for 'exceptions::connection_error'.
|
||||
|
||||
* Fixed a bug in 'posixSocket::connect()' that prevented connecting to
|
||||
servers by specifying an IP address instead of a server name.
|
||||
|
||||
2005-01-03 Vincent Richard <vincent@vincent-richard.net>
|
||||
|
||||
* Fixed linking error on 'typeAdapter <string>::parse()' with g++ versions
|
||||
|
@ -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"; }
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ class connection_error : public messaging_exception
|
||||
{
|
||||
public:
|
||||
|
||||
connection_error(const exception& other = NO_EXCEPTION);
|
||||
connection_error(const string& what = "", const exception& other = NO_EXCEPTION);
|
||||
~connection_error() throw();
|
||||
|
||||
exception* clone() const;
|
||||
|
Loading…
Reference in New Issue
Block a user