1#include <xrpl/beast/utility/instrumentation.h>
2#include <xrpl/json/json_value.h>
3#include <xrpl/protocol/ErrorCodes.h>
4#include <xrpl/protocol/jss.h>
39 {
rpcATX_DEPRECATED,
"deprecated",
"Use the new API or specify a ledger range.", 400},
41 {
rpcBAD_FEATURE,
"badFeature",
"Feature unknown or invalid.", 500},
42 {
rpcBAD_ISSUER,
"badIssuer",
"Issuer account malformed.", 400},
44 {
rpcBAD_SECRET,
"badSecret",
"Secret does not match account.", 403},
54 {
rpcDST_AMT_MALFORMED,
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed.", 400},
55 {
rpcDST_AMT_MISSING,
"dstAmtMissing",
"Destination amount/currency/issuer is missing.", 400},
59 {
rpcHIGH_FEE,
"highFee",
"Current transaction fee exceeds your limit.", 402},
65 {
rpcJSON_RPC,
"json_rpc",
"JSON-RPC transport error.", 500},
71 {
rpcNOT_ENABLED,
"notEnabled",
"Not enabled in configuration.", 501},
73 {
rpcNOT_READY,
"notReady",
"Not ready to handle this request.", 503},
75 {
rpcNO_CLOSED,
"noClosed",
"Closed ledger is unavailable.", 503},
76 {
rpcNO_CURRENT,
"noCurrent",
"Current ledger is unavailable.", 503},
77 {
rpcNOT_SYNCED,
"notSynced",
"Not synced to the network.", 503},
78 {
rpcNO_EVENTS,
"noEvents",
"Current transport does not support events.", 405},
79 {
rpcNO_NETWORK,
"noNetwork",
"Not synced to the network.", 503},
81 {
rpcNO_PERMISSION,
"noPermission",
"You don't have permission for this command.", 401},
82 {
rpcNO_PF_REQUEST,
"noPathRequest",
"No pathfinding request in progress.", 404},
87 {
rpcSLOW_DOWN,
"slowDown",
"You are placing too much load on the server.", 429},
95 {
rpcTOO_BUSY,
"tooBusy",
"The server is too busy to help you now.", 503},
99 {
rpcBAD_CREDENTIALS,
"badCredentials",
"Credentials do not exist, are not accepted, or have expired.", 400},
100 {
rpcTX_SIGNED,
"transactionSigned",
"Transaction should not be signed.", 400},
109template <
int M,
int N>
121 static_assert(
rpcSUCCESS == 0,
"Unexpected error_code_i layout.");
122 int const index{info.code - 1};
143 if (info.code != expect)
166 if (code <= rpcSUCCESS || code >
rpcLAST)
208 "ripple::RPC::rpcErrorString : input contains an error");
std::string asString() const
Returns the unquoted string value.
bool isMember(char const *key) const
Return true if the object has a member named key.
constexpr auto sortedErrorInfos
constexpr ErrorInfo unknownError
constexpr auto sortErrorInfos(ErrorInfo const (&unordered)[N]) -> std::array< ErrorInfo, M >
static constexpr ErrorInfo unorderedErrorInfos[]
bool contains_error(Json::Value const &json)
Returns true if the json contains an rpc error specification.
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
int error_code_http_status(error_code_i code)
Returns http status that corresponds to the error code.
ErrorInfo const & get_error_info(error_code_i code)
Returns an ErrorInfo that reflects the error code.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string rpcErrorString(Json::Value const &jv)
Returns a single string with the contents of an RPC error.
@ rpcDELEGATE_ACT_NOT_FOUND
@ rpcCHANNEL_AMT_MALFORMED
@ rpcEXPIRED_VALIDATOR_LIST
@ rpcUNEXPECTED_LEDGER_TYPE
Maps an rpc error code to its token, default message, and HTTP status.