1#include <xrpl/protocol/ErrorCodes.h>
3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/jss.h>
40 {
RpcAtxDeprecated,
"deprecated",
"Use the new API or specify a ledger range.", 400},
42 {
RpcBadFeature,
"badFeature",
"Feature unknown or invalid.", 500},
43 {
RpcBadIssuer,
"badIssuer",
"Issuer account malformed.", 400},
45 {
RpcBadSecret,
"badSecret",
"Secret does not match account.", 403},
46 {
RpcBadSeed,
"badSeed",
"Disallowed seed.", 403},
53 {
RpcDstActMissing,
"dstActMissing",
"Destination account not provided.", 400},
55 {
RpcDstAmtMalformed,
"dstAmtMalformed",
"Destination amount/currency/issuer is malformed.", 400},
56 {
RpcDstAmtMissing,
"dstAmtMissing",
"Destination amount/currency/issuer is missing.", 400},
60 {
RpcHighFee,
"highFee",
"Current transaction fee exceeds your limit.", 402},
66 {
RpcJsonRpc,
"json_rpc",
"JSON-RPC transport error.", 500},
72 {
RpcNotEnabled,
"notEnabled",
"Not enabled in configuration.", 501},
73 {
RpcNotImpl,
"notImpl",
"Not implemented.", 501},
74 {
RpcNotReady,
"notReady",
"Not ready to handle this request.", 503},
76 {
RpcNoClosed,
"noClosed",
"Closed ledger is unavailable.", 503},
77 {
RpcNoCurrent,
"noCurrent",
"Current ledger is unavailable.", 503},
78 {
RpcNotSynced,
"notSynced",
"Not synced to the network.", 503},
79 {
RpcNoEvents,
"noEvents",
"Current transport does not support events.", 405},
80 {
RpcNoNetwork,
"noNetwork",
"Not synced to the network.", 503},
82 {
RpcNoPermission,
"noPermission",
"You don't have permission for this command.", 401},
83 {
RpcNoPfRequest,
"noPathRequest",
"No pathfinding request in progress.", 404},
84 {
RpcObjectNotFound,
"objectNotFound",
"The requested object was not found.", 404},
88 {
RpcSlowDown,
"slowDown",
"You are placing too much load on the server.", 429},
96 {
RpcTooBusy,
"tooBusy",
"The server is too busy to help you now.", 503},
100 {
RpcBadCredentials,
"badCredentials",
"Credentials do not exist, are not accepted, or have expired.", 400},
101 {
RpcTxSigned,
"transactionSigned",
"Transaction should not be signed.", 400},
110template <
int M,
int N>
122 static_assert(
RpcSuccess == 0,
"Unexpected error_code_i layout.");
123 int const index{info.code - 1};
144 if (info.code != expect)
179 json[jss::error_message] = message;
185 if (code <= RpcSuccess || code >
RpcLast)
209 return json.isObject() &&
json.isMember(jss::error);
223 XRPL_ASSERT(
RPC::containsError(jv),
"xrpl::RPC::rpcErrorString : input contains an error");
std::string asString() const
Returns the unquoted string value.
JSON (JavaScript Object Notation).
constexpr ErrorInfo kUnknownError
constexpr auto sortErrorInfos(ErrorInfo const (&unordered)[N]) -> std::array< ErrorInfo, M >
static constexpr ErrorInfo kUnorderedErrorInfos[]
constexpr auto kSortedErrorInfos
API version numbers used in later API versions.
json::Value makeError(ErrorCodeI code)
Returns a new json object that reflects the error code.
int errorCodeHttpStatus(ErrorCodeI code)
Returns http status that corresponds to the error code.
ErrorInfo const & getErrorInfo(ErrorCodeI code)
Returns an ErrorInfo that reflects the error code.
void injectError(ErrorCodeI code, json::Value &json)
Add or update the json update to reflect the error code.
bool containsError(json::Value const &json)
Returns true if the json contains an rpc error specification.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
@ RpcExpiredValidatorList
@ RpcUnexpectedLedgerType
std::string rpcErrorString(json::Value const &jv)
Returns a single string with the contents of an RPC error.
Maps an rpc error code to its token, default message, and HTTP status.
json::StaticString message