mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
scripted-diff: Remove double newlines after some init errors
Some InitError calls had trailing \n characters, causing double newlines in error output. After this change InitError calls consistently output one newline instead of two. Appearance of messages in the GUI does not seem to be affected. Can be tested with: src/bitcoind -regtest -datadir=noexist src/qt/bitcoin-qt -regtest -datadir=noexist -BEGIN VERIFY SCRIPT- git grep -l InitError src/ | xargs sed -i 's/\(InitError(.*\)\\n"/\1"/' -END VERIFY SCRIPT-
This commit is contained in:
parent
cb40639bdf
commit
c361df90b9
2 changed files with 13 additions and 13 deletions
|
@ -120,7 +120,7 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
|
|||
SetupServerArgs(args);
|
||||
std::string error;
|
||||
if (!args.ParseParameters(argc, argv, error)) {
|
||||
return InitError(Untranslated(strprintf("Error parsing command line arguments: %s\n", error)));
|
||||
return InitError(Untranslated(strprintf("Error parsing command line arguments: %s", error)));
|
||||
}
|
||||
|
||||
// Process help and version before taking care about datadir
|
||||
|
@ -151,22 +151,22 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
|
|||
try
|
||||
{
|
||||
if (!CheckDataDirOption(args)) {
|
||||
return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.\n", args.GetArg("-datadir", ""))));
|
||||
return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.", args.GetArg("-datadir", ""))));
|
||||
}
|
||||
if (!args.ReadConfigFiles(error, true)) {
|
||||
return InitError(Untranslated(strprintf("Error reading configuration file: %s\n", error)));
|
||||
return InitError(Untranslated(strprintf("Error reading configuration file: %s", error)));
|
||||
}
|
||||
// Check for chain settings (Params() calls are only valid after this clause)
|
||||
try {
|
||||
SelectParams(args.GetChainName());
|
||||
} catch (const std::exception& e) {
|
||||
return InitError(Untranslated(strprintf("%s\n", e.what())));
|
||||
return InitError(Untranslated(strprintf("%s", e.what())));
|
||||
}
|
||||
|
||||
// Error out when loose non-argument tokens are encountered on command line
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (!IsSwitchChar(argv[i][0])) {
|
||||
return InitError(Untranslated(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i])));
|
||||
return InitError(Untranslated(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.", argv[i])));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
|
|||
}
|
||||
break;
|
||||
case -1: // Error happened.
|
||||
return InitError(Untranslated(strprintf("fork_daemon() failed: %s\n", SysErrorString(errno))));
|
||||
return InitError(Untranslated(strprintf("fork_daemon() failed: %s", SysErrorString(errno))));
|
||||
default: { // Parent: wait and exit.
|
||||
int token = daemon_ep.TokenRead();
|
||||
if (token) { // Success
|
||||
|
@ -222,7 +222,7 @@ static bool AppInit(NodeContext& node, int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
#else
|
||||
return InitError(Untranslated("-daemon is not supported on this operating system\n"));
|
||||
return InitError(Untranslated("-daemon is not supported on this operating system"));
|
||||
#endif // HAVE_DECL_FORK
|
||||
}
|
||||
// Lock data directory after daemonization
|
||||
|
|
|
@ -176,7 +176,7 @@ static bool InitSettings()
|
|||
if (!gArgs.ReadSettingsFile(&errors)) {
|
||||
std::string error = QT_TRANSLATE_NOOP("bitcoin-core", "Settings file could not be read");
|
||||
std::string error_translated = QCoreApplication::translate("bitcoin-core", error.c_str()).toStdString();
|
||||
InitError(Untranslated(strprintf("%s:\n%s\n", error, MakeUnorderedList(errors))));
|
||||
InitError(Untranslated(strprintf("%s:\n%s", error, MakeUnorderedList(errors))));
|
||||
|
||||
QMessageBox messagebox(QMessageBox::Critical, PACKAGE_NAME, QString::fromStdString(strprintf("%s.", error_translated)), QMessageBox::Reset | QMessageBox::Abort);
|
||||
/*: Explanatory text shown on startup when the settings file cannot be read.
|
||||
|
@ -199,7 +199,7 @@ static bool InitSettings()
|
|||
if (!gArgs.WriteSettingsFile(&errors)) {
|
||||
std::string error = QT_TRANSLATE_NOOP("bitcoin-core", "Settings file could not be written");
|
||||
std::string error_translated = QCoreApplication::translate("bitcoin-core", error.c_str()).toStdString();
|
||||
InitError(Untranslated(strprintf("%s:\n%s\n", error, MakeUnorderedList(errors))));
|
||||
InitError(Untranslated(strprintf("%s:\n%s", error, MakeUnorderedList(errors))));
|
||||
|
||||
QMessageBox messagebox(QMessageBox::Critical, PACKAGE_NAME, QString::fromStdString(strprintf("%s.", error_translated)), QMessageBox::Ok);
|
||||
/*: Explanatory text shown on startup when the settings file could not be written.
|
||||
|
@ -546,7 +546,7 @@ int GuiMain(int argc, char* argv[])
|
|||
SetupUIArgs(gArgs);
|
||||
std::string error;
|
||||
if (!gArgs.ParseParameters(argc, argv, error)) {
|
||||
InitError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error));
|
||||
InitError(strprintf(Untranslated("Error parsing command line arguments: %s"), error));
|
||||
// Create a message box, because the gui has neither been created nor has subscribed to core signals
|
||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||
// message cannot be translated because translations have not been initialized
|
||||
|
@ -589,7 +589,7 @@ int GuiMain(int argc, char* argv[])
|
|||
|
||||
/// 6a. Determine availability of data directory
|
||||
if (!CheckDataDirOption(gArgs)) {
|
||||
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
|
||||
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist."), gArgs.GetArg("-datadir", "")));
|
||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
|
||||
return EXIT_FAILURE;
|
||||
|
@ -598,7 +598,7 @@ int GuiMain(int argc, char* argv[])
|
|||
/// 6b. Parse bitcoin.conf
|
||||
/// - Do not call gArgs.GetDataDirNet() before this step finishes
|
||||
if (!gArgs.ReadConfigFiles(error, true)) {
|
||||
InitError(strprintf(Untranslated("Error reading configuration file: %s\n"), error));
|
||||
InitError(strprintf(Untranslated("Error reading configuration file: %s"), error));
|
||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
|
||||
return EXIT_FAILURE;
|
||||
|
@ -613,7 +613,7 @@ int GuiMain(int argc, char* argv[])
|
|||
// Check for chain settings (Params() calls are only valid after this clause)
|
||||
SelectParams(gArgs.GetChainName());
|
||||
} catch(std::exception &e) {
|
||||
InitError(Untranslated(strprintf("%s\n", e.what())));
|
||||
InitError(Untranslated(strprintf("%s", e.what())));
|
||||
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue