Socket/Protocols/INet: Allow socket address string representation to omit the address...
[senf.git] / Socket / Protocols / INet / INet4Address.cc
index 6d75b16..043e215 100644 (file)
@@ -54,7 +54,7 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s
         return senf::INet4Address::from_inaddr(ina.s_addr);
 
     if  (s.empty())
-        throw SyntaxException();
+        throw AddressSyntaxException();
 
     int herr (0);
 
@@ -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(
@@ -129,11 +129,11 @@ prefix_ senf::INet4Network::INet4Network(std::string s)
 {
     std::string::size_type i (s.find('/'));
     if (i == std::string::npos)
-        throw INet4Address::SyntaxException();
+        throw AddressSyntaxException();
     try {
         prefix_len_ = boost::lexical_cast<unsigned>(std::string(s,i+1));
     } catch (boost::bad_lexical_cast const &) {
-        throw INet4Address::SyntaxException();
+        throw AddressSyntaxException();
     }
     address_ = INet4Address(INet4Address::from_string(std::string(s, 0, i)).address() & mask());
 }