Skip to content

Including exception what() in Runaway dialog box #876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@

#include <boost/signals2/connection.hpp>
#include <chrono>
#include <exception>
#include <memory>
#include <string>

#include <QApplication>
#include <QDebug>
Expand Down Expand Up @@ -680,7 +682,13 @@ int GuiMain(int argc, char* argv[])
}
} catch (const std::exception& e) {
PrintExceptionContinue(&e, "Runaway exception");
app.handleRunawayException(QString::fromStdString(app.node().getWarnings().translated));
std::string message = app.node().getWarnings().translated;
const std::string& what = e.what();
if (!message.empty() && !what.empty()) {
message += "\n\n";
}
message += what;
app.handleRunawayException(QString::fromStdString(message));
} catch (...) {
PrintExceptionContinue(nullptr, "Runaway exception");
app.handleRunawayException(QString::fromStdString(app.node().getWarnings().translated));
Expand Down
11 changes: 10 additions & 1 deletion src/qt/initexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <util/threadnames.h>

#include <exception>
#include <string>

#include <QDebug>
#include <QMetaObject>
Expand All @@ -34,7 +35,15 @@ InitExecutor::~InitExecutor()
void InitExecutor::handleRunawayException(const std::exception* e)
{
PrintExceptionContinue(e, "Runaway exception");
Q_EMIT runawayException(QString::fromStdString(m_node.getWarnings().translated));
std::string message = m_node.getWarnings().translated;
if (e) {
const std::string& what = e->what();
if (!message.empty() && !what.empty()) {
message += "\n\n";
}
message += what;
}
Q_EMIT runawayException(QString::fromStdString(message));
}

void InitExecutor::initialize()
Expand Down
Loading