diff options
| author | Wladimir J. van der Laan <[email protected]> | 2012-04-15 09:22:26 -0700 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2012-04-15 09:22:26 -0700 |
| commit | 9ea8e60a0c8531e647521531d4b0fed757abc331 (patch) | |
| tree | 7d1d5e39091be54d23f8dd2bf1a1f5a0cf73a08f /src/qt/bitcoin.cpp | |
| parent | Merge pull request #1100 from luke-jr/qrcode_errchk (diff) | |
| parent | Show a message box when runaway exception happens (diff) | |
| download | discoin-9ea8e60a0c8531e647521531d4b0fed757abc331.tar.xz discoin-9ea8e60a0c8531e647521531d4b0fed757abc331.zip | |
Merge pull request #1097 from laanwj/2012_04_runawayexception
Show a message box when runaway exception happens
Diffstat (limited to 'src/qt/bitcoin.cpp')
| -rw-r--r-- | src/qt/bitcoin.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index bfb49cbca..463b2cfa7 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -119,6 +119,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); +} + #ifdef WIN32 #define strncasecmp strnicmp #endif @@ -284,9 +293,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; } |