diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-04-07 10:10:01 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-04-07 10:16:09 +0200 |
commit | 4ae5e72128f605d0fc25bba1d42c0434375d712e (patch) | |
tree | c68e11bcbe036d94eed2712daa29a058354c76ab /src/qt | |
parent | f4e1c347cf1861595609ba841d35c4a59b50bde2 (diff) |
Show error message if ReadConfigFile fails
A runaway exception was raised if ReadConfigFile fails (usually
due to a parse error in bitcoin.conf). Show an error message instead.
Fixes #4013.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoin.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 0db4308bf6..696e65ec19 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -507,7 +507,13 @@ int main(int argc, char *argv[]) QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"]))); return 1; } - ReadConfigFile(mapArgs, mapMultiArgs); + try { + ReadConfigFile(mapArgs, mapMultiArgs); + } catch(std::exception &e) { + QMessageBox::critical(0, QObject::tr("Bitcoin"), + QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what())); + return false; + } /// 7. Determine network (and switch to network specific options) // - Do not call Params() before this step |