Bitcoin Core
22.99.0
P2P Digital Currency
src
util
error.cpp
Go to the documentation of this file.
1
// Copyright (c) 2010-2021 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
11
bilingual_str
TransactionErrorString
(
const
TransactionError
err)
12
{
13
switch
(err) {
14
case
TransactionError::OK
:
15
return
Untranslated
(
"No error"
);
16
case
TransactionError::MISSING_INPUTS
:
17
return
Untranslated
(
"Inputs missing or spent"
);
18
case
TransactionError::ALREADY_IN_CHAIN
:
19
return
Untranslated
(
"Transaction already in block chain"
);
20
case
TransactionError::P2P_DISABLED
:
21
return
Untranslated
(
"Peer-to-peer functionality missing or disabled"
);
22
case
TransactionError::MEMPOOL_REJECTED
:
23
return
Untranslated
(
"Transaction rejected by mempool"
);
24
case
TransactionError::MEMPOOL_ERROR
:
25
return
Untranslated
(
"Mempool internal error"
);
26
case
TransactionError::INVALID_PSBT
:
27
return
Untranslated
(
"PSBT is not well-formed"
);
28
case
TransactionError::PSBT_MISMATCH
:
29
return
Untranslated
(
"PSBTs not compatible (different transactions)"
);
30
case
TransactionError::SIGHASH_MISMATCH
:
31
return
Untranslated
(
"Specified sighash value does not match value stored in PSBT"
);
32
case
TransactionError::MAX_FEE_EXCEEDED
:
33
return
Untranslated
(
"Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)"
);
34
case
TransactionError::EXTERNAL_SIGNER_NOT_FOUND
:
35
return
Untranslated
(
"External signer not found"
);
36
case
TransactionError::EXTERNAL_SIGNER_FAILED
:
37
return
Untranslated
(
"External signer failed to sign"
);
38
// no default case, so the compiler can warn about missing cases
39
}
40
assert
(
false
);
41
}
42
43
bilingual_str
ResolveErrMsg
(
const
std::string& optname,
const
std::string& strBind)
44
{
45
return
strprintf
(
_
(
"Cannot resolve -%s address: '%s'"
), optname, strBind);
46
}
47
48
bilingual_str
AmountHighWarn
(
const
std::string& optname)
49
{
50
return
strprintf
(
_
(
"%s is set very high!"
), optname);
51
}
52
53
bilingual_str
AmountErrMsg
(
const
std::string& optname,
const
std::string& strValue)
54
{
55
return
strprintf
(
_
(
"Invalid amount for -%s=<amount>: '%s'"
), optname, strValue);
56
}
_
bilingual_str _(const char *psz)
Translation function.
Definition:
translation.h:63
assert
assert(!tx.IsCoinBase())
TransactionError::MEMPOOL_REJECTED
@ MEMPOOL_REJECTED
TransactionErrorString
bilingual_str TransactionErrorString(const TransactionError err)
Definition:
error.cpp:11
TransactionError::EXTERNAL_SIGNER_FAILED
@ EXTERNAL_SIGNER_FAILED
bilingual_str
Bilingual messages:
Definition:
translation.h:16
ResolveErrMsg
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
Definition:
error.cpp:43
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:53
AmountHighWarn
bilingual_str AmountHighWarn(const std::string &optname)
Definition:
error.cpp:48
TransactionError
TransactionError
Definition:
error.h:22
Untranslated
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition:
translation.h:46
TransactionError::EXTERNAL_SIGNER_NOT_FOUND
@ EXTERNAL_SIGNER_NOT_FOUND
TransactionError::INVALID_PSBT
@ INVALID_PSBT
TransactionError::SIGHASH_MISMATCH
@ SIGHASH_MISMATCH
error.h
TransactionError::P2P_DISABLED
@ P2P_DISABLED
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:1164
translation.h
TransactionError::OK
@ OK
No error.
TransactionError::MISSING_INPUTS
@ MISSING_INPUTS
TransactionError::MAX_FEE_EXCEEDED
@ MAX_FEE_EXCEEDED
TransactionError::ALREADY_IN_CHAIN
@ ALREADY_IN_CHAIN
Generated on Fri Feb 18 2022 20:03:52 for Bitcoin Core by
1.8.17