refactor: Error message bilingual_str consistency

- Move the decision whether to translate an error message to where it is
  defined. This simplifies call sites: no more `InitError(Untranslated(...))`.

- Make all functions in `util/error.h` consistently return a
  `bilingual_str`. We've decided to use this as error message type so
  let's roll with it.

This has no functional changes: no messages are changed, no new
translation messages are defined.
This commit is contained in:
Wladimir J. van der Laan
2020-06-05 14:26:16 +02:00
parent a79bca2f1f
commit 77b79fa6ef
10 changed files with 47 additions and 41 deletions

View File

@@ -10,6 +10,7 @@
#include <tinyformat.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#include <tuple>
@@ -285,7 +286,7 @@ UniValue JSONRPCTransactionError(TransactionError terr, const std::string& err_s
if (err_string.length() > 0) {
return JSONRPCError(RPCErrorFromTransactionError(terr), err_string);
} else {
return JSONRPCError(RPCErrorFromTransactionError(terr), TransactionErrorString(terr));
return JSONRPCError(RPCErrorFromTransactionError(terr), TransactionErrorString(terr).original);
}
}