qt: Add BitcoinApplication::handleNonFatalException function

This helper function will be used in the following commits.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
Hennadii Stepanov 2021-03-27 18:52:22 +02:00
parent af7e365b15
commit 64a8755af3
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 16 additions and 0 deletions

View file

@ -426,6 +426,16 @@ void BitcoinApplication::handleRunawayException(const QString &message)
::exit(EXIT_FAILURE);
}
void BitcoinApplication::handleNonFatalException(const QString& message)
{
assert(QThread::currentThread() == thread());
QMessageBox::warning(
nullptr, tr("Internal error"),
tr("An internal error occurred. %1 will attempt to continue safely. This is "
"an unexpected bug which can be reported as described below.").arg(PACKAGE_NAME) %
QLatin1String("<br><br>") % GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT));
}
WId BitcoinApplication::getMainWinId() const
{
if (!window)

View file

@ -99,6 +99,12 @@ public Q_SLOTS:
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
void handleRunawayException(const QString &message);
/**
* A helper function that shows a message box
* with details about a non-fatal exception.
*/
void handleNonFatalException(const QString& message);
Q_SIGNALS:
void requestedInitialize();
void requestedShutdown();