diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-15 03:29:20 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-15 10:39:54 +0300 |
commit | d24ef6058f2d60100be44507d46014ef30010493 (patch) | |
tree | b355d18a2b0f963a6fad9af9f6fa67b2850d31cf /include/winapi/error.hpp | |
parent | test: add test utility "args" (diff) | |
download | winapi-common-d24ef6058f2d60100be44507d46014ef30010493.tar.gz winapi-common-d24ef6058f2d60100be44507d46014ef30010493.zip |
WIP: add simple Process class
Diffstat (limited to '')
-rw-r--r-- | include/winapi/error.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/winapi/error.hpp b/include/winapi/error.hpp index 4b3f1e0..89bcfed 100644 --- a/include/winapi/error.hpp +++ b/include/winapi/error.hpp @@ -9,6 +9,8 @@ #include <windows.h> +#include <sstream> +#include <stdexcept> #include <string> #include <system_error> @@ -31,5 +33,12 @@ inline const CategoryWindows& category_windows() { std::system_error windows(DWORD code, const char* function); +template <typename Ret> +std::runtime_error custom(Ret ret, const char* function) { + std::ostringstream oss; + oss << "Function " << function << " failed with error code " << ret; + return std::runtime_error{oss.str()}; +} + } // namespace error } // namespace winapi |