From 8e5648d0a65c43aa5e1e35373488a5ca2eaa9f3a Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Wed, 15 Sep 2021 12:34:01 +0200 Subject: POSIX implementation of ThrowSystemException using std::system_error --- zencore/include/zencore/except.h | 14 +++++++++----- 1 file 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() { -- cgit v1.2.3