aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-15 12:34:01 +0200
committerMartin Ridgers <[email protected]>2021-09-15 12:34:01 +0200
commit8e5648d0a65c43aa5e1e35373488a5ca2eaa9f3a (patch)
tree037b733825dad5652c1c328a56786c766b3b43af /zencore/include
parentMoved system_error include to except.h for std::error_code (diff)
downloadzen-8e5648d0a65c43aa5e1e35373488a5ca2eaa9f3a.tar.xz
zen-8e5648d0a65c43aa5e1e35373488a5ca2eaa9f3a.zip
POSIX implementation of ThrowSystemException using std::system_error
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/except.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/zencore/include/zencore/except.h b/zencore/include/zencore/except.h
index eff03d8ce..aa4c1462d 100644
--- a/zencore/include/zencore/except.h
+++ b/zencore/include/zencore/except.h
@@ -51,17 +51,21 @@ private:
ZENCORE_API void ThrowSystemException(HRESULT hRes, std::string_view Message);
+ZENCORE_API void ThrowLastError(std::string_view Message);
+ZENCORE_API void ThrowLastError(std::string_view Message, const std::source_location& Location);
+ZENCORE_API std::string GetLastErrorAsString();
+ZENCORE_API std::string GetWindowsErrorAsString(uint32_t Win32ErrorCode);
+
inline void
ThrowSystemException(const char* Message)
{
+#if ZEN_PLATFORM_WINDOWS
throw WindowsException(Message);
+#else
+ ThrowLastError(Message);
+#endif
}
-ZENCORE_API void ThrowLastError(std::string_view Message);
-ZENCORE_API void ThrowLastError(std::string_view Message, const std::source_location& Location);
-ZENCORE_API std::string GetLastErrorAsString();
-ZENCORE_API std::string GetWindowsErrorAsString(uint32_t Win32ErrorCode);
-
inline int32_t
GetLastError()
{