Utils: Implement more flexible SystemException
[senf.git] / Scheduler / WriteHelper.ct
index f573f95..afc09c6 100644 (file)
 
 // Custom includes
 #include <errno.h>
-#include "Utils/Exception.hh"
+#include "../Utils/Exception.hh"
 #include "Scheduler.hh"
 
 #define prefix_
 ///////////////////////////////ct.p////////////////////////////////////////
 
 template <class Handle>
-prefix_ senf::WriteHelper<Handle>::WriteHelper(Handle handle, std::string data,
+prefix_ senf::WriteHelper<Handle>::WriteHelper(Handle handle, std::string const & data,
                                                       Callback callback)
     : handle_(handle), data_(data), callback_(callback),
       offset_(data_.begin()), errno_(0)
@@ -78,7 +78,7 @@ prefix_ void senf::WriteHelper<Handle>::process(Handle handle,
     bool complete_ (false);
     try {
         if (event != senf::Scheduler::EV_WRITE)
-            throw senf::SystemException(EPIPE);
+            throwErrno(EPIPE);
         offset_ = handle.write(std::make_pair(offset_,data_.end()));
         if (offset_ == data_.end()) {
             data_.erase();
@@ -87,7 +87,7 @@ prefix_ void senf::WriteHelper<Handle>::process(Handle handle,
         }
     }
     catch (senf::SystemException const & ex) {
-        errno_ = ex.err;
+        errno_ = ex.code();
         done();
         return;
     }
@@ -113,4 +113,5 @@ prefix_ void senf::WriteHelper<Handle>::done()
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
 // compile-command: "scons -u test"
+// comment-column: 40
 // End: