Skip to content

Commit

Permalink
qt: Add BitcoinApplication::handleNonFatalException function
Browse files Browse the repository at this point in the history
This helper function will be used in the following commits.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
  • Loading branch information
hebasto and ryanofsky committed Apr 1, 2021
1 parent af7e365 commit 64a8755
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/qt/bitcoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 64a8755

Please sign in to comment.