From: jkaeber Date: Wed, 12 Mar 2008 08:24:06 +0000 (+0000) Subject: Changed UnknownHostnameException's argument processing X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=2de40c83b3baa5d4bcd39441be710821f1a638f6;p=senf.git Changed UnknownHostnameException's argument processing git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@743 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/AddressExceptions.hh b/Socket/Protocols/AddressExceptions.hh index 2409cd0..19c916f 100644 --- a/Socket/Protocols/AddressExceptions.hh +++ b/Socket/Protocols/AddressExceptions.hh @@ -46,14 +46,16 @@ namespace senf { struct AddressSyntaxException : public AddressException { AddressSyntaxException() : AddressException("invalid address syntax") {} - AddressSyntaxException(std::string const & msg) : AddressException(msg) {} + AddressSyntaxException(const std::string &addr) + : AddressException("Invalid address syntax (\"" + addr + "\")") {} }; /** \brief Resolver failure */ struct UnknownHostnameException : public AddressException { UnknownHostnameException() : AddressException("failed to resolve hostname") {} - UnknownHostnameException(std::string const & msg) : AddressException(msg) {} + UnknownHostnameException(const std::string &hostname) + : AddressException("Failed to resolve hostname (\"" + hostname + "\")") {} }; } diff --git a/Socket/Protocols/INet/INet4Address.cc b/Socket/Protocols/INet/INet4Address.cc index 2086b6e..043e215 100644 --- a/Socket/Protocols/INet/INet4Address.cc +++ b/Socket/Protocols/INet/INet4Address.cc @@ -80,9 +80,9 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s # endif // __GLIBC__ if (!ent) - throw UnknownHostnameException(); + throw UnknownHostnameException(s); if (ent->h_addrtype != AF_INET) - throw UnknownHostnameException(); + throw UnknownHostnameException(s); // We are only interested in the first address ... return senf::INet4Address::from_inaddr( diff --git a/Socket/Protocols/INet/INet6Address.cc b/Socket/Protocols/INet/INet6Address.cc index ad2e741..6631ec4 100644 --- a/Socket/Protocols/INet/INet6Address.cc +++ b/Socket/Protocols/INet/INet6Address.cc @@ -82,7 +82,7 @@ prefix_ senf::INet6Address senf::INet6Address::from_string(std::string const & s if (resolve == ResolveINet4) return from_inet4address(INet4Address::from_string(s)); else - throw UnknownHostnameException(); + throw UnknownHostnameException(s); } prefix_ std::ostream & senf::operator<<(std::ostream & os, INet6Address const & addr)