1#ifndef XRPL_PROTOCOL_ERRORCODES_H_INCLUDED
2#define XRPL_PROTOCOL_ERRORCODES_H_INCLUDED
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/jss.h>
175 ,
message(
"An unknown error code.")
183 char const* message_)
191 char const* message_,
212template <
class JsonValue>
217 json[jss::error] = info.
token;
218 json[jss::error_code] = info.
code;
219 json[jss::error_message] = info.
message;
222template <
class JsonValue>
229template <
class JsonValue>
234 json[jss::error] = info.
token;
235 json[jss::error_code] = info.
code;
236 json[jss::error_message] = message;
260 return "Missing field '" + name +
"'.";
278 return "Invalid field '" + name +
"', not object.";
296 return "Invalid field '" + name +
"'.";
320 return "Invalid field '" + name +
"', not " + type +
".";
Lightweight wrapper to tag static string.
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.
Json::Value invalid_field_error(std::string const &name)
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Json::Value make_param_error(std::string const &message)
Returns a new json object that indicates invalid parameters.
std::string missing_field_message(std::string const &name)
Json::Value not_validator_error()
int error_code_http_status(error_code_i code)
Returns http status that corresponds to the error code.
std::string invalid_field_message(std::string const &name)
std::string expected_field_message(std::string const &name, std::string const &type)
Json::Value object_field_error(std::string const &name)
std::string object_field_message(std::string const &name)
ErrorInfo const & get_error_info(error_code_i code)
Returns an ErrorInfo that reflects the error code.
Json::Value expected_field_error(std::string const &name, std::string const &type)
Json::Value missing_field_error(std::string const &name)
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
@ rpcREPORTING_UNSUPPORTED
warning_code_i
Codes returned in the warnings array of certain RPC commands.
@ warnRPC_EXPIRED_VALIDATOR_LIST
@ warnRPC_FIELDS_DEPRECATED
@ warnRPC_UNSUPPORTED_MAJORITY
@ warnRPC_AMENDMENT_BLOCKED
Maps an rpc error code to its token, default message, and HTTP status.
constexpr ErrorInfo(error_code_i code_, char const *token_, char const *message_)
Json::StaticString message
constexpr ErrorInfo(error_code_i code_, char const *token_, char const *message_, int http_status_)