Bitcoin Core  24.99.0
P2P Digital Currency
error.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <util/error.h>
6 
7 #include <tinyformat.h>
8 #include <util/translation.h>
9 
10 #include <cassert>
11 #include <string>
12 
14 {
15  switch (err) {
17  return Untranslated("No error");
19  return Untranslated("Inputs missing or spent");
21  return Untranslated("Transaction already in block chain");
23  return Untranslated("Peer-to-peer functionality missing or disabled");
25  return Untranslated("Transaction rejected by mempool");
27  return Untranslated("Mempool internal error");
29  return Untranslated("PSBT is not well-formed");
31  return Untranslated("PSBTs not compatible (different transactions)");
33  return Untranslated("Specified sighash value does not match value stored in PSBT");
35  return Untranslated("Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)");
37  return Untranslated("External signer not found");
39  return Untranslated("External signer failed to sign");
41  return Untranslated("Transaction rejected due to invalid package");
42  // no default case, so the compiler can warn about missing cases
43  }
44  assert(false);
45 }
46 
47 bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind)
48 {
49  return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind);
50 }
51 
52 bilingual_str InvalidPortErrMsg(const std::string& optname, const std::string& invalid_value)
53 {
54  return strprintf(_("Invalid port specified in %s: '%s'"), optname, invalid_value);
55 }
56 
57 bilingual_str AmountHighWarn(const std::string& optname)
58 {
59  return strprintf(_("%s is set very high!"), optname);
60 }
61 
62 bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue)
63 {
64  return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
65 }
bilingual_str TransactionErrorString(const TransactionError err)
Definition: error.cpp:13
bilingual_str AmountHighWarn(const std::string &optname)
Definition: error.cpp:57
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
Definition: error.cpp:62
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
Definition: error.cpp:47
bilingual_str InvalidPortErrMsg(const std::string &optname, const std::string &invalid_value)
Definition: error.cpp:52
TransactionError
Definition: error.h:22
Bilingual messages:
Definition: translation.h:18
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1162
bilingual_str _(const char *psz)
Translation function.
Definition: translation.h:65
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:48
assert(!tx.IsCoinBase())