]> git.tdb.fi Git - libs/net.git/blobdiff - source/datagramsocket.cpp
Use SystemError at appropriate places
[libs/net.git] / source / datagramsocket.cpp
index 1394ffa59db669965f94564a777385ac85e91ce6..9779bfeb268acb4722c3f21fb85b251405856c1c 100644 (file)
@@ -25,7 +25,7 @@ int DatagramSocket::connect(const SockAddr &addr)
 
        int err=::connect(handle, &sa, size);
        if(err==-1)
-               throw Exception(format("Unable to connect: %s", strerror(errno)));
+               throw SystemError("Unable to connect", errno);
 
        delete peer_addr;
        peer_addr=addr.copy();
@@ -56,7 +56,7 @@ unsigned DatagramSocket::sendto(const char *buf, unsigned size, const SockAddr &
                if(errno==EAGAIN)
                        return 0;
                else
-                       throw Exception(format("Sendto failed: %s", strerror(errno)));
+                       throw SystemError("Sendto failed", errno);
        }
 
        return ret;
@@ -78,7 +78,7 @@ unsigned DatagramSocket::recvfrom(char *buf, unsigned size, SockAddr *&addr_)
                if(errno==EAGAIN)
                        return 0;
                else
-                       throw Exception(format("Recvfrom failed: %s", strerror(errno)));
+                       throw SystemError("Recvfrom failed", errno);
        }
 
        addr_=SockAddr::create(addr);