node: Make translations of fatal errors consistent

The extra `bilingual_str` argument of the fatal error notifications and
`node::AbortNode()` is often unused and when used usually contains the
same string as the message argument. It also seems to be confusing,
since it is not consistently used for errors requiring user action. For
example some assumeutxo fatal errors require the user to do something,
but are not translated.

So simplify the fatal error and abort node interfaces by only passing a
translated string. This slightly changes the fatal errors displayed to
the user.

Also de-duplicate the abort error log since it is repeated in noui.cpp.
This commit is contained in:
TheCharlatan
2024-03-15 21:42:44 +01:00
parent b50554babd
commit ddc7872c08
14 changed files with 52 additions and 58 deletions

View File

@@ -89,14 +89,13 @@ int main(int argc, char* argv[])
{
std::cout << "Warning: " << warning.original << std::endl;
}
void flushError(const std::string& debug_message) override
void flushError(const bilingual_str& message) override
{
std::cerr << "Error flushing block data to disk: " << debug_message << std::endl;
std::cerr << "Error flushing block data to disk: " << message.original << std::endl;
}
void fatalError(const std::string& debug_message, const bilingual_str& user_message) override
void fatalError(const bilingual_str& message) override
{
std::cerr << "Error: " << debug_message << std::endl;
std::cerr << (user_message.empty() ? "A fatal internal error occurred." : user_message.original) << std::endl;
std::cerr << "Error: " << message.original << std::endl;
}
};
auto notifications = std::make_unique<KernelNotifications>();