MCPcopy Create free account
hub / github.com/SpriteOvO/AirPodsDesktop / FatalError

Function FatalError

Source/Error.cpp:59–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57} // namespace Error
58
59[[noreturn]] void FatalError(const std::string &content, bool report)
60{
61 Error::Impl::WriteStackTraceFile();
62
63#if !defined APD_OS_WIN
64 #error "Need to port."
65#endif
66
67 // Because QMessageBox does not allow calls from non-GUI threads.
68 // So far, there seems to be no better way than using native APIs.
69 //
70
71 auto title = std::format("{} fatal error", Config::ProgramName);
72
73 if (report) {
74 auto message = std::format(
75 "An error has occurred!\n"
76 "Please help us fix this problem.\n"
77 "--------------------------------------------------\n"
78 "\n"
79 "{}\n"
80 "\n"
81 "--------------------------------------------------\n"
82 "Click \"Yes\" will pop up GitHub issue tracker page.\n"
83 "You can submit this information to us there.\n"
84 "Thank you very much.",
85 content);
86
87 int button = MessageBoxA(nullptr, message.c_str(), title.c_str(), MB_ICONERROR | MB_YESNO);
88
89#if !defined APD_DEBUG
90 if (button == IDYES) {
91 QDesktopServices::openUrl(QUrl{Config::UrlIssues});
92 }
93#endif
94 }
95 else {
96 MessageBoxA(nullptr, content.c_str(), title.c_str(), MB_ICONERROR | MB_OK);
97 }
98
99#if defined APD_DEBUG
100 Utils::Debug::BreakPoint();
101#endif
102
103 std::abort();
104}

Callers 9

Opts.cppFile · 0.85
InitializeFunction · 0.85
InitSettingsMethod · 0.85
SingleInstanceFunction · 0.85
TriggerFunction · 0.85
IsVersionOrGreaterFunction · 0.85
ChangeButtonActionMethod · 0.85
OnButtonClickedMethod · 0.85

Calls 2

WriteStackTraceFileFunction · 0.85
BreakPointFunction · 0.85

Tested by

no test coverage detected