aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-04-07 10:10:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-04-07 10:16:09 +0200
commit4ae5e72128f605d0fc25bba1d42c0434375d712e (patch)
treec68e11bcbe036d94eed2712daa29a058354c76ab /src/bitcoin-cli.cpp
parentf4e1c347cf1861595609ba841d35c4a59b50bde2 (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/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 817369fe95..ca6950a162 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -27,7 +27,12 @@ static bool AppInitRPC(int argc, char* argv[])
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
return false;
}
- ReadConfigFile(mapArgs, mapMultiArgs);
+ try {
+ ReadConfigFile(mapArgs, mapMultiArgs);
+ } catch(std::exception &e) {
+ fprintf(stderr,"Error reading configuration file: %s\n", e.what());
+ return false;
+ }
// Check for -testnet or -regtest parameter (TestNet() calls are only valid after this clause)
if (!SelectParamsFromCommandLine()) {
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");