X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FAddressExceptions.hh;h=ea020dec7d8e2c726b920b30677f19958f47529e;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=51338ca29cf683f9228e3ec131a406febd49bd0c;hpb=f2b5e3087a3520fa650580251788a2d4cf738d37;p=senf.git diff --git a/Socket/Protocols/AddressExceptions.hh b/Socket/Protocols/AddressExceptions.hh index 51338ca..ea020de 100644 --- a/Socket/Protocols/AddressExceptions.hh +++ b/Socket/Protocols/AddressExceptions.hh @@ -23,28 +23,40 @@ /** \file \brief AddressExceptions public header */ -#ifndef HH_AddressExceptions_ -#define HH_AddressExceptions_ 1 +#ifndef HH_SENF_Socket_Protocols_AddressExceptions_ +#define HH_SENF_Socket_Protocols_AddressExceptions_ 1 // Custom includes +#include "../Utils/Exception.hh" //#include "AddressExceptions.mpp" ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - /** \brief Base-class for INet4Address exceptions */ - struct AddressException : public std::exception {}; + /** \brief Base-class for Address exceptions */ + struct AddressException : public senf::Exception + { + protected: + AddressException(std::string const & msg) + : senf::Exception(msg) {} + }; - /** \brief Invalid INet4 address syntax */ + /** \brief Invalid address syntax */ struct AddressSyntaxException : public AddressException - { virtual char const * what() const throw() - { return "invalid INet4 address syntax"; } }; + { + AddressSyntaxException() : AddressException("invalid address syntax") {} + AddressSyntaxException(const std::string &addr) + : AddressException("Invalid address syntax (\"" + addr + "\")") {} + }; /** \brief Resolver failure */ struct UnknownHostnameException : public AddressException - { virtual char const * what() const throw() - { return "failed to resolve INet4 hostname"; } }; + { + UnknownHostnameException() : AddressException("failed to resolve hostname") {} + UnknownHostnameException(const std::string &hostname) + : AddressException("Failed to resolve hostname (\"" + hostname + "\")") {} + }; }