MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / HandleCommon

Method HandleCommon

ProgramLog/error/error.cpp:73–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73std::thread Error::impl::HandleCommon(spdlog::level::level_enum level, std::wstring_view message, std::wstring_view error_message, std::source_location location, Util::null_terminated_wstring_view title, std::wstring_view description, unsigned int type)
74{
75 // allow calls to err handling without needing to initialize logging
76 if (Log::IsInitialized())
77 {
78 Log(GetLogMessage(message, error_message), level, location);
79 }
80
81 if (!IsDebuggerPresent())
82 {
83 std::size_t messageLength = description.length() + 2 + message.length();
84 const bool hasErrorMessage = !error_message.empty();
85 if (hasErrorMessage)
86 {
87 messageLength += 2;
88 messageLength += error_message.length();
89 }
90
91 std::wstring dialogMessage;
92 dialogMessage.reserve(messageLength);
93 dialogMessage += description;
94 dialogMessage += L"\n\n";
95 dialogMessage += message;
96
97 if (hasErrorMessage)
98 {
99 dialogMessage += L"\n\n";
100 dialogMessage += error_message;
101 }
102
103 return std::thread([title, type, body = std::move(dialogMessage)]() noexcept
104 {
105 MessageBoxEx(nullptr, body.c_str(), title.c_str(), type | MB_OK | MB_SETFOREGROUND, MAKELANGID(LANG_ENGLISH, SUBLANG_NEUTRAL));
106 });
107 }
108 else
109 {
110 return {};
111 }
112}
113
114void Error::impl::HandleCriticalCommon(std::wstring_view message, std::wstring_view error_message, std::source_location location)
115{

Callers

nothing calls this directly

Calls 2

LogClass · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected