1 // Copyright (c) 2010-2019 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 #ifndef BITCOIN_UTIL_ERROR_H
6 #define BITCOIN_UTIL_ERROR_H
7 
8 /**
9  * util/error.h is a common place for definitions of simple error types and
10  * string functions. Types and functions defined here should not require any
11  * outside dependencies.
12  *
13  * Error types defined here can be used in different parts of the
14  * codebase, to avoid the need to write boilerplate code catching and
15  * translating errors passed across wallet/node/rpc/gui code boundaries.
16  */
17 
18 #include <string>
19 
20 struct bilingual_str;
21 
22 enum class TransactionError {
23     OK, //!< No error
24     MISSING_INPUTS,
25     ALREADY_IN_CHAIN,
26     P2P_DISABLED,
27     MEMPOOL_REJECTED,
28     MEMPOOL_ERROR,
29     INVALID_PSBT,
30     PSBT_MISMATCH,
31     SIGHASH_MISMATCH,
32     MAX_FEE_EXCEEDED,
33 };
34 
35 bilingual_str TransactionErrorString(const TransactionError error);
36 
37 bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind);
38 
39 bilingual_str AmountHighWarn(const std::string& optname);
40 
41 bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue);
42 
43 #endif // BITCOIN_UTIL_ERROR_H
44