Changed UnknownHostnameException's argument processing
jkaeber [Wed, 12 Mar 2008 08:24:06 +0000 (08:24 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@743 270642c3-0616-0410-b53a-bc976706d245

Socket/Protocols/AddressExceptions.hh
Socket/Protocols/INet/INet4Address.cc
Socket/Protocols/INet/INet6Address.cc

index 2409cd0..19c916f 100644 (file)
@@ -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 + "\")") {}
     };
 
 }        
index 2086b6e..043e215 100644 (file)
@@ -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(
index ad2e741..6631ec4 100644 (file)
@@ -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)