aboutsummaryrefslogtreecommitdiff
path: root/zencore/except.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-25 09:54:09 +0200
committerStefan Boberg <[email protected]>2021-05-25 09:54:09 +0200
commit882e93e4786f9e67e0edf6c276b16bb40848bae9 (patch)
treec5d4c45679c676c6aeb804c7601f43340b78ea0b /zencore/except.cpp
parentUpdated structured cache description (diff)
parentCompile out all rocksdb code for a smaller binary (diff)
downloadzen-882e93e4786f9e67e0edf6c276b16bb40848bae9.tar.xz
zen-882e93e4786f9e67e0edf6c276b16bb40848bae9.zip
Merged from origin/main
Diffstat (limited to 'zencore/except.cpp')
-rw-r--r--zencore/except.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/zencore/except.cpp b/zencore/except.cpp
index b02122f58..882f69f9a 100644
--- a/zencore/except.cpp
+++ b/zencore/except.cpp
@@ -1,17 +1,27 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include <zencore/except.h>
+#include <system_error>
namespace zen {
void
-ThrowSystemException([[maybe_unused]] HRESULT hRes, [[maybe_unused]] const char* Message)
+ThrowSystemException([[maybe_unused]] HRESULT hRes, [[maybe_unused]] std::string_view Message)
{
- // TODO
-
- int ErrValue = hRes;
+ if (HRESULT_FACILITY(hRes) == FACILITY_WIN32)
+ {
+ throw std::system_error(std::error_code(hRes & 0xffff, std::system_category()), std::string(Message));
+ }
+ else
+ {
+ throw WindowsException(hRes, Message);
+ }
+}
- throw std::system_error(ErrValue, std::system_category(), Message);
+void
+ThrowLastError(std::string_view Message)
+{
+ throw std::system_error(std::error_code(::GetLastError(), std::system_category()), std::string(Message));
}
} // namespace zen