Browse Source
Merge pull request #4018
4ae5e72
Show error message if ReadConfigFile fails (Wladimir J. van der Laan)
metaverse
Wladimir J. van der Laan
10 years ago
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
3 changed files with
20 additions and
3 deletions
-
src/bitcoin-cli.cpp
-
src/bitcoind.cpp
-
src/qt/bitcoin.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"); |
|
|
|
|
|
@ -70,7 +70,13 @@ bool AppInit(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"); |
|
|
|
|
|
@ -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
|
|
|
|