Skip to content

Commit 6fe9890

Browse files
committed
refactor: Change Node::initError to take bilingual_str
Make it consistent with `Chain::initError`.
1 parent 425e7cb commit 6fe9890

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/interfaces/node.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace {
5656
class NodeImpl : public Node
5757
{
5858
public:
59-
void initError(const std::string& message) override { InitError(Untranslated(message)); }
59+
void initError(const bilingual_str& message) override { InitError(message); }
6060
bool parseParameters(int argc, const char* const argv[], std::string& error) override
6161
{
6262
return gArgs.ParseParameters(argc, argv, error);

src/interfaces/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Node
4545
virtual ~Node() {}
4646

4747
//! Send init error.
48-
virtual void initError(const std::string& message) = 0;
48+
virtual void initError(const bilingual_str& message) = 0;
4949

5050
//! Set command line arguments.
5151
virtual bool parseParameters(int argc, const char* const argv[], std::string& error) = 0;

src/qt/bitcoin.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ int GuiMain(int argc, char* argv[])
457457
SetupUIArgs();
458458
std::string error;
459459
if (!node->parseParameters(argc, argv, error)) {
460-
node->initError(strprintf("Error parsing command line arguments: %s\n", error));
460+
node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error));
461461
// Create a message box, because the gui has neither been created nor has subscribed to core signals
462462
QMessageBox::critical(nullptr, PACKAGE_NAME,
463463
// message can not be translated because translations have not been initialized
@@ -498,13 +498,13 @@ int GuiMain(int argc, char* argv[])
498498
/// 6. Determine availability of data directory and parse bitcoin.conf
499499
/// - Do not call GetDataDir(true) before this step finishes
500500
if (!CheckDataDirOption()) {
501-
node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")));
501+
node->initError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
502502
QMessageBox::critical(nullptr, PACKAGE_NAME,
503503
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
504504
return EXIT_FAILURE;
505505
}
506506
if (!node->readConfigFiles(error)) {
507-
node->initError(strprintf("Error reading configuration file: %s\n", error));
507+
node->initError(strprintf(Untranslated("Error reading configuration file: %s\n"), error));
508508
QMessageBox::critical(nullptr, PACKAGE_NAME,
509509
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
510510
return EXIT_FAILURE;
@@ -520,7 +520,7 @@ int GuiMain(int argc, char* argv[])
520520
try {
521521
node->selectParams(gArgs.GetChainName());
522522
} catch(std::exception &e) {
523-
node->initError(strprintf("%s\n", e.what()));
523+
node->initError(Untranslated(strprintf("%s\n", e.what())));
524524
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
525525
return EXIT_FAILURE;
526526
}

0 commit comments

Comments
 (0)