Bitcoin ABC  0.24.10
P2P Digital Currency
error.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2018 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/system.h>
9 #include <util/translation.h>
10 
12  switch (error) {
14  return Untranslated("No error");
16  return Untranslated("Missing inputs");
18  return Untranslated("Transaction already in block chain");
20  return Untranslated(
21  "Peer-to-peer functionality missing or disabled");
23  return Untranslated("Transaction rejected by AcceptToMemoryPool");
25  return Untranslated("AcceptToMemoryPool failed");
27  return Untranslated("PSBT is not sane");
29  return Untranslated(
30  "PSBTs not compatible (different transactions)");
32  return Untranslated(
33  "Specified sighash value does not match existing value");
35  return Untranslated("Fee exceeds maximum configured by user (e.g. "
36  "-maxtxfee, maxfeerate)");
37  // no default case, so the compiler can warn about missing cases
38  }
39  assert(false);
40 }
41 
42 bilingual_str ResolveErrMsg(const std::string &optname,
43  const std::string &strBind) {
44  return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind);
45 }
46 
47 bilingual_str AmountHighWarn(const std::string &optname) {
48  return strprintf(_("%s is set very high!"), optname);
49 }
50 
51 bilingual_str AmountErrMsg(const std::string &optname,
52  const std::string &strValue) {
53  return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname,
54  strValue);
55 }
_
bilingual_str _(const char *psz)
Translation function.
Definition: translation.h:55
TransactionError::MEMPOOL_REJECTED
@ MEMPOOL_REJECTED
bilingual_str
Bilingual messages:
Definition: translation.h:17
ResolveErrMsg
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
Definition: error.cpp:42
TransactionError::MEMPOOL_ERROR
@ MEMPOOL_ERROR
TransactionError::PSBT_MISMATCH
@ PSBT_MISMATCH
tinyformat.h
AmountErrMsg
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
Definition: error.cpp:51
AmountHighWarn
bilingual_str AmountHighWarn(const std::string &optname)
Definition: error.cpp:47
TransactionError
TransactionError
Definition: error.h:22
Untranslated
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:36
TransactionError::INVALID_PSBT
@ INVALID_PSBT
TransactionError::SIGHASH_MISMATCH
@ SIGHASH_MISMATCH
error.h
TransactionError::P2P_DISABLED
@ P2P_DISABLED
TransactionErrorString
bilingual_str TransactionErrorString(const TransactionError error)
Definition: error.cpp:11
system.h
strprintf
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1201
translation.h
TransactionError::OK
@ OK
No error.
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:48
TransactionError::MISSING_INPUTS
@ MISSING_INPUTS
TransactionError::MAX_FEE_EXCEEDED
@ MAX_FEE_EXCEEDED
TransactionError::ALREADY_IN_CHAIN
@ ALREADY_IN_CHAIN