From: g0dil Date: Mon, 26 Nov 2007 08:13:39 +0000 (+0000) Subject: Utils: Rename SystemException::code() to SystemException::errorNumber() X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=d267cc9325ff49f1ef76aa7ddf6b51ceaafd3026;p=senf.git Utils: Rename SystemException::code() to SystemException::errorNumber() Utils: Rename Daemon::fail() to Daemon::exit() git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@535 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Scheduler/ReadHelper.ct b/Scheduler/ReadHelper.ct index 1be8a8d..89375b1 100644 --- a/Scheduler/ReadHelper.ct +++ b/Scheduler/ReadHelper.ct @@ -85,7 +85,7 @@ prefix_ void senf::ReadHelper::process(Handle handle, } } catch (senf::SystemException const & ex) { - errno_ = ex.code(); + errno_ = ex.errorNumber(); done(); return; } diff --git a/Scheduler/WriteHelper.ct b/Scheduler/WriteHelper.ct index afc09c6..17d06f4 100644 --- a/Scheduler/WriteHelper.ct +++ b/Scheduler/WriteHelper.ct @@ -87,7 +87,7 @@ prefix_ void senf::WriteHelper::process(Handle handle, } } catch (senf::SystemException const & ex) { - errno_ = ex.code(); + errno_ = ex.errorNumber(); done(); return; } diff --git a/Utils/Daemon/Daemon.cc b/Utils/Daemon/Daemon.cc index d008c38..201fe37 100644 --- a/Utils/Daemon/Daemon.cc +++ b/Utils/Daemon/Daemon.cc @@ -151,15 +151,15 @@ prefix_ void senf::Daemon::detach() namespace { /* Purposely *not* derived from std::exception */ - struct DaemonFailureException { - DaemonFailureException(unsigned c) : code(c) {} + struct DaemonExitException { + DaemonExitException(unsigned c) : code(c) {} unsigned code; }; } -prefix_ void senf::Daemon::fail(unsigned code) +prefix_ void senf::Daemon::exit(unsigned code) { - throw DaemonFailureException(code); + throw DaemonExitException(code); } prefix_ int senf::Daemon::start(int argc, char const ** argv) @@ -182,8 +182,8 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv) main(); } - catch (DaemonFailureException & e) { - return e.code > 0 ? e.code : 1; + catch (DaemonExitException & e) { + return e.code; } #ifdef NDEBUG diff --git a/Utils/Daemon/Daemon.hh b/Utils/Daemon/Daemon.hh index dc3fb29..3fb0018 100644 --- a/Utils/Daemon/Daemon.hh +++ b/Utils/Daemon/Daemon.hh @@ -156,7 +156,7 @@ namespace senf { int argc(); ///< Access command line parameter count char const ** argv(); ///< Access command line parameters - void fail(unsigned code=1); ///< Terminate daemon with failure + void exit(unsigned code=0); ///< Terminate daemon with failure ///\} diff --git a/Utils/Exception.cci b/Utils/Exception.cci index a601955..40d89a5 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -48,7 +48,7 @@ prefix_ char const * senf::SystemException::what() return buffer_.c_str(); } -prefix_ int senf::SystemException::code() +prefix_ int senf::SystemException::errorNumber() const { return code_; diff --git a/Utils/Exception.hh b/Utils/Exception.hh index 7162040..6b62b68 100644 --- a/Utils/Exception.hh +++ b/Utils/Exception.hh @@ -109,12 +109,12 @@ namespace senf { public: virtual char const * what() const throw(); ///< Return verbose error description - int code() const; ///< Error code (\c errno number) + int errorNumber() const; ///< Error code (\c errno number) char const * description() const; ///< Error description (strerror() value) bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0, int c6=0, int c7=0, int c8=0, int c9=0); - ///< \c true, if code() is one of \a c0 ... \a c9 + ///< \c true, if errorNumber() is one of \a c0 ... \a c9 virtual ~SystemException() throw(); diff --git a/Utils/Exception.test.cc b/Utils/Exception.test.cc index 50e3c97..bf40f0c 100644 --- a/Utils/Exception.test.cc +++ b/Utils/Exception.test.cc @@ -54,7 +54,7 @@ BOOST_AUTO_UNIT_TEST(errnoException) } } catch (senf::SystemException & e) { - BOOST_CHECK_EQUAL( e.code(), ENOENT ); + BOOST_CHECK_EQUAL( e.errorNumber(), ENOENT ); BOOST_CHECK_EQUAL( e.what(), "::open(): (2) No such file or directory: x=1, y=2" ); } }