Add throw_code methods to errno_error

This commit is contained in:
Danny Robson 2012-04-30 11:50:53 +10:00
parent 6a6c732f36
commit 51e2e223cc
2 changed files with 16 additions and 1 deletions

View File

@ -48,7 +48,7 @@ errno_error::errno_error ():
/// Throw an errno_error exception if errno currently signals an error. /// Throw an errno_error exception if errno currently signals an error.
void void
errno_error::try_code () errno_error::try_code (void)
{ try_code (errno); } { try_code (errno); }
@ -58,3 +58,15 @@ errno_error::try_code(int code) {
if (code != 0) if (code != 0)
throw errno_error(code); throw errno_error(code);
} }
void
errno_error::throw_code (void)
{ throw_code (errno); }
void
errno_error::throw_code (int code) {
check_hard (code != 0);
throw errno_error (code);
}

View File

@ -49,6 +49,9 @@ class errno_error : public std::runtime_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 (void);
static void throw_code (int code);
}; };