From 51e2e223cc621dc4195ec749c0f15b6cc6851cd4 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 30 Apr 2012 11:50:53 +1000 Subject: [PATCH] Add throw_code methods to errno_error --- except.cpp | 14 +++++++++++++- except.hpp | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/except.cpp b/except.cpp index a1e63de2..5ce0288d 100644 --- a/except.cpp +++ b/except.cpp @@ -48,7 +48,7 @@ errno_error::errno_error (): /// Throw an errno_error exception if errno currently signals an error. void -errno_error::try_code () +errno_error::try_code (void) { try_code (errno); } @@ -58,3 +58,15 @@ errno_error::try_code(int code) { if (code != 0) 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); +} diff --git a/except.hpp b/except.hpp index 6f1df799..13687859 100644 --- a/except.hpp +++ b/except.hpp @@ -49,6 +49,9 @@ class errno_error : public std::runtime_error { static void try_code (void); static void try_code (int code); + + static void throw_code (void); + static void throw_code (int code); };