win32: add except::try_value

This commit is contained in:
Danny Robson 2018-08-14 16:47:44 +10:00
parent 9a929353d6
commit 2e3aaa4c17
2 changed files with 14 additions and 1 deletions

View File

@ -45,6 +45,17 @@ error::last_code (void)
}
///////////////////////////////////////////////////////////////////////////////
HANDLE
error::try_value (HANDLE value)
{
if (value != INVALID_HANDLE_VALUE)
return value;
throw_code ();
}
///////////////////////////////////////////////////////////////////////////////
void
error::try_code (void)
@ -79,7 +90,7 @@ error::throw_code (DWORD code)
}
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
std::string
error::code_string (void)
{

View File

@ -22,6 +22,8 @@ namespace cruft::win32 {
DWORD code (void) const;
static DWORD last_code (void);
static HANDLE try_value (HANDLE);
static void try_code (void);
static void try_code (DWORD);