except: rename errno_error::id to m_code

This commit is contained in:
Danny Robson 2016-04-27 16:06:32 +10:00
parent b1eb9982d1
commit 354573f369
2 changed files with 16 additions and 15 deletions

View File

@ -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 /// Construct an errno_error from a given error value. The error value MUST signal an error at
/// construction time. /// construction time.
errno_error::errno_error (int _errno): errno_error::errno_error (int _code):
runtime_error (strerror (_errno)), runtime_error (strerror (_code)),
id (_errno) 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 /// Construct an errno_error from the current value of errno. errno MUST signal an error at
/// construction time. /// construction time.
errno_error::errno_error (): errno_error::errno_error ():
runtime_error (strerror (errno)), errno_error (last_code ())
id (errno)
{ {
CHECK_NEQ (errno, 0); CHECK_NEQ (m_code, 0);
} }

View File

@ -49,16 +49,18 @@ namespace util {
/// An exception class used for reporting errors signalled by errno. /// An exception class used for reporting errors signalled by errno.
class errno_error : public std::runtime_error { class errno_error : public std::runtime_error {
public: public:
int id; errno_error (int code);
errno_error (int _errno); errno_error ();
errno_error ();
static void try_code (void); static void try_code (void);
static void try_code (int code); static void try_code (int code);
static void throw_code [[gnu::noreturn]] (void); static void throw_code [[gnu::noreturn]] (void);
static void throw_code [[gnu::noreturn]] (int code); static void throw_code [[gnu::noreturn]] (int code);
private:
int m_code;
}; };
} }