aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-04-14 09:41:05 +0200
committerLuke Dashjr <luke-jr+git@utopios.org>2012-04-15 13:25:35 -0400
commitcb1035a00882405fac47eb92e7086c7231062e3d (patch)
tree1f4e56ac21443dbe86e0a5986841aa5c64fe64f7 /src/qt
parent79940a679303d107021cf15c3c602b73170c5423 (diff)
downloadbitcoin-cb1035a00882405fac47eb92e7086c7231062e3d.tar.xz
Show a message box when runaway exception happens
This is more clear to users than when the program simply disappears (usually during initialization). It still logs the message to the console and debug log as well.
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 1133f122e7..74ace600e0 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -120,6 +120,15 @@ std::string _(const char* psz)
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
+/* Handle runaway exceptions. Shows a message box with the problem and quits the program.
+ */
+static void handleRunawayException(std::exception *e)
+{
+ PrintExceptionContinue(e, "Runaway exception");
+ QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occured. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
+ exit(1);
+}
+
int main(int argc, char *argv[])
{
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
@@ -197,9 +206,9 @@ int main(int argc, char *argv[])
return 1;
}
} catch (std::exception& e) {
- PrintException(&e, "Runaway exception");
+ handleRunawayException(&e);
} catch (...) {
- PrintException(NULL, "Runaway exception");
+ handleRunawayException(NULL);
}
return 0;
}