Display error message when unrecoverable error occurred

PR #19462.
This commit is contained in:
Vladimir Golovnev 2023-08-14 16:03:57 +03:00 committed by GitHub
parent cab5edb721
commit a0e41a11de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 21 deletions

View file

@ -759,7 +759,6 @@ void Application::processParams(const QBtCommandLineParameters &params)
}
int Application::exec()
try
{
#if !defined(DISABLE_WEBUI) && defined(DISABLE_GUI)
const QString loadingStr = tr("WebUI will be started shortly after internal preparations. Please wait...");
@ -928,21 +927,6 @@ try
return BaseApplication::exec();
}
catch (const RuntimeError &err)
{
#ifdef DISABLE_GUI
fprintf(stderr, "%s", qPrintable(err.message()));
#else
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(QCoreApplication::translate("Application", "Application failed to start."));
msgBox.setInformativeText(err.message());
msgBox.show(); // Need to be shown or to moveToCenter does not work
msgBox.move(Utils::Gui::screenCenter(&msgBox));
msgBox.exec();
#endif
return EXIT_FAILURE;
}
bool Application::isRunning()
{