aboutsummaryrefslogtreecommitdiff
path: root/zencore/except.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-12 13:40:55 +0200
committerStefan Boberg <[email protected]>2021-09-12 13:40:55 +0200
commit04ec4af02c38fc9474ebd392147fe7128a177298 (patch)
tree51ba9ffd6ca2b9dfd767f8b3361ef36382755c53 /zencore/except.cpp
parentHttpResponse enum -> HttpResponseCode (diff)
downloadzen-04ec4af02c38fc9474ebd392147fe7128a177298.tar.xz
zen-04ec4af02c38fc9474ebd392147fe7128a177298.zip
Added some std::error_code helpers
* Added MakeWin32ErrorCode/MakeErrorCodeFromLastError * Fixed GetLastErrorAsString() implementation so it doesn't throw (!)
Diffstat (limited to 'zencore/except.cpp')
-rw-r--r--zencore/except.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/zencore/except.cpp b/zencore/except.cpp
index 00cb826f6..9bd447308 100644
--- a/zencore/except.cpp
+++ b/zencore/except.cpp
@@ -28,7 +28,13 @@ ThrowLastError(std::string_view Message)
std::string
GetLastErrorAsString()
{
- throw std::error_code(::GetLastError(), std::system_category()).message();
+ return GetWindowsErrorAsString(::GetLastError());
+}
+
+std::string
+GetWindowsErrorAsString(uint32_t Win32ErrorCode)
+{
+ return std::error_code(Win32ErrorCode, std::system_category()).message();
}
void