except: add throw_code for win32_error
This commit is contained in:
parent
a8d341632e
commit
fa9fac1d92
33
except.cpp
33
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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user