Socket: fixed bug in readfrom where socklen was not set
[senf.git] / Socket / Protocols / AddressExceptions.hh
index ff59751..ea020de 100644 (file)
@@ -23,8 +23,8 @@
 /** \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"
@@ -34,7 +34,7 @@
 
 namespace senf {
 
-    /** \brief Base-class for INet4Address exceptions */
+    /** \brief Base-class for Address exceptions */
     struct AddressException : public senf::Exception
     {
     protected:
@@ -42,13 +42,21 @@ namespace senf {
             : senf::Exception(msg) {}
     };
 
-    /** \brief Invalid INet4 address syntax */
+    /** \brief Invalid address syntax */
     struct AddressSyntaxException : public AddressException
-    { AddressSyntaxException() : AddressException("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
-    { UnknownHostnameException() : AddressException("failed to resolve INet4 hostname") {} };
+    { 
+        UnknownHostnameException() : AddressException("failed to resolve hostname") {} 
+        UnknownHostnameException(const std::string &hostname)
+            : AddressException("Failed to resolve hostname (\"" + hostname + "\")") {}
+    };
 
 }