From fa86dbd4af6ff50fe21f909727676e2867f0b168 Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Fri, 7 Jan 2022 14:41:45 +0100 Subject: Turn all ThrowLastError() sites in source_location variants --- zencore/except.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'zencore/except.cpp') diff --git a/zencore/except.cpp b/zencore/except.cpp index fae629286..b4ad5acf2 100644 --- a/zencore/except.cpp +++ b/zencore/except.cpp @@ -57,12 +57,6 @@ ThrowSystemException([[maybe_unused]] HRESULT hRes, [[maybe_unused]] std::string #endif // ZEN_PLATFORM_WINDOWS -void -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) { @@ -83,12 +77,18 @@ GetSystemErrorAsString(uint32_t ErrorCode) #if defined(__cpp_lib_source_location) void -ThrowLastError(std::string_view Message, const std::source_location& Location) +ThrowLastErrorImpl(std::string_view Message, const std::source_location& Location) { using namespace fmt::literals; throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()), "{}({}): {}"_format(Location.file_name(), Location.line(), Message)); } +#else +void +ThrowLastError(std::string_view Message) +{ + throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()), std::string(Message)); +} #endif } // namespace zen -- cgit v1.2.3 From 9086231f3923c0df6d9ef817441bfae5e134e8ff Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Mon, 10 Jan 2022 12:07:03 +0100 Subject: Converted use of _format UDL to fmt::format --- zencore/except.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'zencore/except.cpp') diff --git a/zencore/except.cpp b/zencore/except.cpp index b4ad5acf2..2749d1984 100644 --- a/zencore/except.cpp +++ b/zencore/except.cpp @@ -79,9 +79,8 @@ GetSystemErrorAsString(uint32_t ErrorCode) void ThrowLastErrorImpl(std::string_view Message, const std::source_location& Location) { - using namespace fmt::literals; throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()), - "{}({}): {}"_format(Location.file_name(), Location.line(), Message)); + fmt::format("{}({}): {}", Location.file_name(), Location.line(), Message)); } #else void -- cgit v1.2.3