aboutsummaryrefslogtreecommitdiff
path: root/src/win/exception.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-28 00:03:11 +0800
committercrupest <crupest@outlook.com>2020-06-28 00:03:11 +0800
commit06d1d0442276a05b6caad6e3468f4afb1e8ee5df (patch)
treeebd46f0fb7343dc57bf947b7b5fffc139c3ddeac /src/win/exception.cpp
parente11be6caa9ef9b2b198ca61846e32f469627556e (diff)
downloadcru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.tar.gz
cru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.tar.bz2
cru-06d1d0442276a05b6caad6e3468f4afb1e8ee5df.zip
...
Diffstat (limited to 'src/win/exception.cpp')
-rw-r--r--src/win/exception.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/win/exception.cpp b/src/win/exception.cpp
deleted file mode 100644
index 9f9fb03d..00000000
--- a/src/win/exception.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "cru/win/Exception.hpp"
-
-#include <fmt/format.h>
-#include <optional>
-
-namespace cru::platform::win {
-
-inline std::string HResultMakeMessage(HRESULT h_result,
- std::optional<std::string_view> message) {
- if (message.has_value())
- return fmt::format(FMT_STRING("HRESULT: {:#08x}. Message: {}"), h_result,
- *message);
- else
- return fmt::format(FMT_STRING("HRESULT: {:#08x}."), h_result);
-}
-
-HResultError::HResultError(HRESULT h_result)
- : PlatformException(HResultMakeMessage(h_result, std::nullopt)),
- h_result_(h_result) {}
-
-HResultError::HResultError(HRESULT h_result,
- const std::string_view& additional_message)
- : PlatformException(HResultMakeMessage(h_result, additional_message)),
- h_result_(h_result) {}
-
-inline std::string Win32MakeMessage(DWORD error_code,
- std::string_view message) {
- return fmt::format("Last error code: {:#04x}.\nMessage: {}\n", error_code,
- message);
-}
-
-Win32Error::Win32Error(const std::string_view& message)
- : Win32Error(::GetLastError(), message) {}
-
-Win32Error::Win32Error(DWORD error_code, const std::string_view& message)
- : PlatformException(Win32MakeMessage(error_code, message)),
- error_code_(error_code) {}
-} // namespace cru::platform::win