winapi_common
Classes | Functions
error.hpp File Reference

Make std::system_error work with GetLastError(). More...

Go to the source code of this file.

Classes

class  winapi::error::CategoryWindows
 

Functions

const CategoryWindows & winapi::error::category_windows ()
 
std::system_error winapi::error::windows (DWORD code, const char *function)
 
template<typename Ret >
std::runtime_error winapi::error::custom (Ret ret, const char *function)
 

Detailed Description

Make std::system_error work with GetLastError().

Definition in file error.hpp.

Function Documentation

◆ windows()

std::system_error winapi::error::windows ( DWORD  code,
const char *  function 
)

Build a std::system_error from the value of GetLastError().

Parameters
codeValue of GetLastError().
functionName of the function that failed, like "CreateFile".

Definition at line 61 of file error.cpp.