Utils: Implement helper macros to add file/line information to SystemException's
[senf.git] / Socket / FileHandle.cc
index 3b3ef9d..2b1e176 100644 (file)
@@ -44,7 +44,7 @@
 prefix_ void senf::FileBody::close()
 {
     if (!valid())
-        throw SystemException(EBADF);
+        throw SystemException(EBADF SENF_EXC_DEBUGINFO);
     v_close();
     fd_ = -1;
 }
@@ -71,7 +71,7 @@ prefix_ void senf::FileBody::destroyClose()
 prefix_ void senf::FileBody::v_close()
 {
     if (::close(fd_) != 0)
-        throw SystemException();
+        SENF_THROW_SYSTEM_EXCEPTION("");
 }
 
 prefix_ void senf::FileBody::v_terminate()
@@ -95,17 +95,17 @@ prefix_ bool senf::FileBody::blocking()
     const
 {
     int flags = ::fcntl(fd(),F_GETFL);
-    if (flags < 0) throw SystemException();
+    if (flags < 0) SENF_THROW_SYSTEM_EXCEPTION("");
     return ! (flags & O_NONBLOCK);
 }
 
 prefix_ void senf::FileBody::blocking(bool status)
 {
     int flags = ::fcntl(fd(),F_GETFL);
-    if (flags < 0) throw SystemException();
+    if (flags < 0) SENF_THROW_SYSTEM_EXCEPTION("");
     if (status) flags &= ~O_NONBLOCK;
     else        flags |= O_NONBLOCK;
-    if (::fcntl(fd(), F_SETFL, flags) < 0) throw SystemException();
+    if (::fcntl(fd(), F_SETFL, flags) < 0) SENF_THROW_SYSTEM_EXCEPTION("");
 }
 
 /* We don't take POLLIN/POLLOUT as argument to avoid having to include
@@ -126,7 +126,7 @@ prefix_ bool senf::FileBody::pollCheck(int fd, bool incoming, bool block)
             case EINTR:
                 break;
             default:
-                throw SystemException();
+                SENF_THROW_SYSTEM_EXCEPTION("");
             }
     } while (rv<0);
     return rv>0;