From 354573f3695cffdf6c20d49c7f5bbff1e3f948cd Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 27 Apr 2016 16:06:32 +1000 Subject: [PATCH] except: rename errno_error::id to m_code --- except.cpp | 13 ++++++------- except.hpp | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/except.cpp b/except.cpp index 65e63fb3..a0baed74 100644 --- a/except.cpp +++ b/except.cpp @@ -29,11 +29,11 @@ using util::errno_error; /////////////////////////////////////////////////////////////////////////////// /// Construct an errno_error from a given error value. The error value MUST signal an error at /// construction time. -errno_error::errno_error (int _errno): - runtime_error (strerror (_errno)), - id (_errno) +errno_error::errno_error (int _code): + runtime_error (strerror (_code)), + m_code (_code) { - CHECK_NEQ (_errno, 0); + CHECK_NEQ (_code, 0); } @@ -41,10 +41,9 @@ errno_error::errno_error (int _errno): /// Construct an errno_error from the current value of errno. errno MUST signal an error at /// construction time. errno_error::errno_error (): - runtime_error (strerror (errno)), - id (errno) + errno_error (last_code ()) { - CHECK_NEQ (errno, 0); + CHECK_NEQ (m_code, 0); } diff --git a/except.hpp b/except.hpp index 3d4a8736..cec46785 100644 --- a/except.hpp +++ b/except.hpp @@ -49,16 +49,18 @@ namespace util { /// An exception class used for reporting errors signalled by errno. class errno_error : public std::runtime_error { - public: - int id; - errno_error (int _errno); - errno_error (); + public: + errno_error (int code); + errno_error (); - static void try_code (void); - static void try_code (int code); + static void try_code (void); + static void try_code (int code); - static void throw_code [[gnu::noreturn]] (void); - static void throw_code [[gnu::noreturn]] (int code); + static void throw_code [[gnu::noreturn]] (void); + static void throw_code [[gnu::noreturn]] (int code); + + private: + int m_code; }; }