From 70312a507fa41a4d76d0ca0fd43424c7dc910641 Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Mon, 26 Nov 2007 08:13:39 +0000 Subject: [PATCH] Utils: Rename SystemException::code() to SystemException::errorNumber() Utils: Rename Daemon::fail() to Daemon::exit() --- Scheduler/ReadHelper.ct | 2 +- Scheduler/WriteHelper.ct | 2 +- Utils/Daemon/Daemon.cc | 12 ++++++------ Utils/Daemon/Daemon.hh | 2 +- Utils/Exception.cci | 2 +- Utils/Exception.hh | 4 ++-- Utils/Exception.test.cc | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Scheduler/ReadHelper.ct b/Scheduler/ReadHelper.ct index 1be8a8df..89375b19 100644 --- a/Scheduler/ReadHelper.ct +++ b/Scheduler/ReadHelper.ct @@ -85,7 +85,7 @@ prefix_ void senf::ReadHelper<Handle>::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 afc09c69..17d06f4d 100644 --- a/Scheduler/WriteHelper.ct +++ b/Scheduler/WriteHelper.ct @@ -87,7 +87,7 @@ prefix_ void senf::WriteHelper<Handle>::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 d008c384..201fe37f 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 dc3fb294..3fb0018a 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 a6019552..40d89a5f 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 7162040d..6b62b681 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 50e3c977..bf40f0c1 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" ); } } -- GitLab