diff --git a/except.cpp b/except.cpp index 6e5358c5..5625e04e 100644 --- a/except.cpp +++ b/except.cpp @@ -105,20 +105,37 @@ win32_error::win32_error (void): } +/////////////////////////////////////////////////////////////////////////////// void -win32_error::try_code (void) { - const auto id = GetLastError (); - if (id == ERROR_SUCCESS) - return; - - throw win32_error (id); +win32_error::try_code (void) +{ + try_code (GetLastError ()); } //----------------------------------------------------------------------------- void -win32_error::throw_code (void) { - const auto id = GetLastError (); +win32_error::try_code (DWORD id) +{ + if (id == ERROR_SUCCESS) + return; + + throw_code (id); +} + + +//----------------------------------------------------------------------------- +void +win32_error::throw_code (void) +{ + throw_code (GetLastError ()); +} + + +//----------------------------------------------------------------------------- +void +win32_error::throw_code (DWORD id) +{ CHECK (id != ERROR_SUCCESS); throw win32_error (id); } diff --git a/except.hpp b/except.hpp index 73b64ea9..0d211100 100644 --- a/except.hpp +++ b/except.hpp @@ -74,7 +74,10 @@ namespace util { win32_error (); static void try_code (void); - static void throw_code (void); + static void try_code (DWORD); + + static void throw_code [[gnu::noreturn]] (void); + static void throw_code [[gnu::noreturn]] (DWORD); }; } #endif