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 + "\")") {}
};
}
# 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(
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)