]> git.tdb.fi Git - libs/net.git/blobdiff - source/socket.cpp
Use SystemError at appropriate places
[libs/net.git] / source / socket.cpp
index decdbeb9e2fd663c05a7e07819a30bdd0ca6e4bb..fcd686f1f24d810fb1eef4a6bc8faf139c841288 100644 (file)
@@ -77,7 +77,7 @@ void Socket::bind(const SockAddr &addr)
 
        int err=::bind(handle, &sa, size);
        if(err==-1)
-               throw Exception(format("Unable to bind: %s", strerror(errno)));
+               throw SystemError("Unable to bind", errno);
 
        delete local_addr;
        local_addr=addr.copy();
@@ -187,7 +187,7 @@ unsigned Socket::do_write(const char *buf, unsigned size)
                if(errno==EAGAIN)
                        return 0;
                else
-                       throw Exception(format("Writing to socket failed: %s", strerror(errno)));
+                       throw SystemError("Writing to socket failed", errno);
        }
 
        return ret;
@@ -206,7 +206,7 @@ unsigned Socket::do_read(char *buf, unsigned size)
                if(errno==EAGAIN)
                        return 0;
                else
-                       throw Exception(format("Reading from socket failed: %s", strerror(errno)));
+                       throw SystemError("Reading from socket failed", errno);
        }
        else if(ret==0 && !eof_flag)
        {