aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zencore/except.cpp6
-rw-r--r--zencore/include/zencore/except.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/zencore/except.cpp b/zencore/except.cpp
index c06a26edd..44b8edffb 100644
--- a/zencore/except.cpp
+++ b/zencore/except.cpp
@@ -63,6 +63,12 @@ ThrowLastError(std::string_view Message)
throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()), std::string(Message));
}
+void
+ThrowSystemError(uint32_t ErrorCode, std::string_view Message)
+{
+ throw std::system_error(std::error_code(ErrorCode, std::system_category()), std::string(Message));
+}
+
std::string
GetLastErrorAsString()
{
diff --git a/zencore/include/zencore/except.h b/zencore/include/zencore/except.h
index 3bffbd3bb..5cfefb1e2 100644
--- a/zencore/include/zencore/except.h
+++ b/zencore/include/zencore/except.h
@@ -24,6 +24,8 @@ ZENCORE_API void ThrowLastError [[noreturn]] (std::string_view Message);
ZENCORE_API void ThrowLastError [[noreturn]] (std::string_view Message, const std::source_location& Location);
#endif
+ZENCORE_API void ThrowSystemError [[noreturn]] (uint32_t ErrorCode, std::string_view Message);
+
ZENCORE_API std::string GetLastErrorAsString();
ZENCORE_API std::string GetWindowsErrorAsString(uint32_t Win32ErrorCode);