refactor: Change Node::initError to take bilingual_str
Make it consistent with `Chain::initError`.
This commit is contained in:
parent
425e7cb8cf
commit
6fe989054f
|
@ -56,7 +56,7 @@ namespace {
|
||||||
class NodeImpl : public Node
|
class NodeImpl : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initError(const std::string& message) override { InitError(Untranslated(message)); }
|
void initError(const bilingual_str& message) override { InitError(message); }
|
||||||
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
||||||
{
|
{
|
||||||
return gArgs.ParseParameters(argc, argv, error);
|
return gArgs.ParseParameters(argc, argv, error);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
virtual ~Node() {}
|
virtual ~Node() {}
|
||||||
|
|
||||||
//! Send init error.
|
//! Send init error.
|
||||||
virtual void initError(const std::string& message) = 0;
|
virtual void initError(const bilingual_str& message) = 0;
|
||||||
|
|
||||||
//! Set command line arguments.
|
//! Set command line arguments.
|
||||||
virtual bool parseParameters(int argc, const char* const argv[], std::string& error) = 0;
|
virtual bool parseParameters(int argc, const char* const argv[], std::string& error) = 0;
|
||||||
|
|
|
@ -457,7 +457,7 @@ int GuiMain(int argc, char* argv[])
|
||||||
SetupUIArgs();
|
SetupUIArgs();
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!node->parseParameters(argc, argv, error)) {
|
if (!node->parseParameters(argc, argv, error)) {
|
||||||
node->initError(strprintf("Error parsing command line arguments: %s\n", error));
|
node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error));
|
||||||
// Create a message box, because the gui has neither been created nor has subscribed to core signals
|
// Create a message box, because the gui has neither been created nor has subscribed to core signals
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||||
// message can not be translated because translations have not been initialized
|
// message can not be translated because translations have not been initialized
|
||||||
|
@ -498,13 +498,13 @@ int GuiMain(int argc, char* argv[])
|
||||||
/// 6. Determine availability of data directory and parse bitcoin.conf
|
/// 6. Determine availability of data directory and parse bitcoin.conf
|
||||||
/// - Do not call GetDataDir(true) before this step finishes
|
/// - Do not call GetDataDir(true) before this step finishes
|
||||||
if (!CheckDataDirOption()) {
|
if (!CheckDataDirOption()) {
|
||||||
node->initError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")));
|
node->initError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
|
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (!node->readConfigFiles(error)) {
|
if (!node->readConfigFiles(error)) {
|
||||||
node->initError(strprintf("Error reading configuration file: %s\n", error));
|
node->initError(strprintf(Untranslated("Error reading configuration file: %s\n"), error));
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||||
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
|
QObject::tr("Error: Cannot parse configuration file: %1.").arg(QString::fromStdString(error)));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -520,7 +520,7 @@ int GuiMain(int argc, char* argv[])
|
||||||
try {
|
try {
|
||||||
node->selectParams(gArgs.GetChainName());
|
node->selectParams(gArgs.GetChainName());
|
||||||
} catch(std::exception &e) {
|
} catch(std::exception &e) {
|
||||||
node->initError(strprintf("%s\n", e.what()));
|
node->initError(Untranslated(strprintf("%s\n", e.what())));
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
|
QMessageBox::critical(nullptr, PACKAGE_NAME, QObject::tr("Error: %1").arg(e.what()));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue