20#include <xrpl/beast/utility/instrumentation.h>
21#include <xrpl/json/json_value.h>
22#include <xrpl/protocol/ErrorCodes.h>
23#include <xrpl/protocol/jss.h>
58 {
rpcATX_DEPRECATED,
"deprecated",
"Use the new API or specify a ledger range.", 400},
60 {
rpcBAD_FEATURE,
"badFeature",
"Feature unknown or invalid.", 500},
61 {
rpcBAD_ISSUER,
"badIssuer",
"Issuer account malformed.", 400},
63 {
rpcBAD_SECRET,
"badSecret",
"Secret does not match account.", 403},
73 {
rpcDST_AMT_MALFORMED,
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed.", 400},
74 {
rpcDST_AMT_MISSING,
"dstAmtMissing",
"Destination amount/currency/issuer is missing.", 400},
78 {
rpcHIGH_FEE,
"highFee",
"Current transaction fee exceeds your limit.", 402},
84 {
rpcJSON_RPC,
"json_rpc",
"JSON-RPC transport error.", 500},
90 {
rpcNOT_ENABLED,
"notEnabled",
"Not enabled in configuration.", 501},
92 {
rpcNOT_READY,
"notReady",
"Not ready to handle this request.", 503},
94 {
rpcNO_CLOSED,
"noClosed",
"Closed ledger is unavailable.", 503},
95 {
rpcNO_CURRENT,
"noCurrent",
"Current ledger is unavailable.", 503},
96 {
rpcNOT_SYNCED,
"notSynced",
"Not synced to the network.", 503},
97 {
rpcNO_EVENTS,
"noEvents",
"Current transport does not support events.", 405},
98 {
rpcNO_NETWORK,
"noNetwork",
"Not synced to the network.", 503},
100 {
rpcNO_PERMISSION,
"noPermission",
"You don't have permission for this command.", 401},
101 {
rpcNO_PF_REQUEST,
"noPathRequest",
"No pathfinding request in progress.", 404},
106 {
rpcSLOW_DOWN,
"slowDown",
"You are placing too much load on the server.", 429},
114 {
rpcTOO_BUSY,
"tooBusy",
"The server is too busy to help you now.", 503},
118 {
rpcBAD_CREDENTIALS,
"badCredentials",
"Credentials do not exist, are not accepted, or have expired.", 400},
119 {
rpcTX_SIGNED,
"transactionSigned",
"Transaction should not be signed.", 400}};
124template <
int M,
int N>
136 static_assert(
rpcSUCCESS == 0,
"Unexpected error_code_i layout.");
137 int const index{info.code - 1};
158 if (info.code != expect)
181 if (code <= rpcSUCCESS || code >
rpcLAST)
205 if (
json.isObject() &&
json.isMember(jss::error))
223 "ripple::RPC::rpcErrorString : input contains an error");
std::string asString() const
Returns the unquoted string value.
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
Maps an rpc error code to its token, default message, and HTTP status.