Default reporter: shows a synchronous MessageBox. Extracted into a named function so Init(provider) can reference it.
| 57 | // Default reporter: shows a synchronous MessageBox. |
| 58 | // Extracted into a named function so Init(provider) can reference it. |
| 59 | static Reporter MakeDefaultReporter() { |
| 60 | #ifdef _WIN32 |
| 61 | return [](const std::string& message) { |
| 62 | std::wstring wmsg; |
| 63 | int wlen = MultiByteToWideChar(CP_UTF8, 0, message.c_str(), |
| 64 | static_cast<int>(message.size()), nullptr, 0); |
| 65 | if (wlen > 0) { |
| 66 | wmsg.resize(static_cast<size_t>(wlen)); |
| 67 | MultiByteToWideChar(CP_UTF8, 0, message.c_str(), |
| 68 | static_cast<int>(message.size()), |
| 69 | wmsg.data(), wlen); |
| 70 | } |
| 71 | MessageBoxW(nullptr, wmsg.c_str(), |
| 72 | L"CloudRedirect - Cloud Sync Error", |
| 73 | MB_OK | MB_ICONWARNING | MB_SYSTEMMODAL); |
| 74 | }; |
| 75 | #else |
| 76 | return [](const std::string& message) { |
| 77 | (void)message; |
| 78 | }; |
| 79 | #endif |
| 80 | } |
| 81 | |
| 82 | // Lazy-init default reporter for pre-Init error dialogs. |
| 83 | static void EnsureDefaultReporter() { |
no test coverage detected