20#ifndef RIPPLE_PROTOCOL_ERRORCODES_H_INCLUDED
21#define RIPPLE_PROTOCOL_ERRORCODES_H_INCLUDED
23#include <xrpl/json/json_value.h>
24#include <xrpl/protocol/jss.h>
181 ,
message(
"An unknown error code.")
189 char const* message_)
197 char const* message_,
218template <
class JsonValue>
223 json[jss::error] = info.
token;
224 json[jss::error_code] = info.
code;
225 json[jss::error_message] = info.
message;
228template <
class JsonValue>
235template <
class JsonValue>
240 json[jss::error] = info.
token;
241 json[jss::error_code] = info.
code;
242 json[jss::error_message] = message;
266 return "Missing field '" + name +
"'.";
284 return "Invalid field '" + name +
"', not object.";
302 return "Invalid field '" + name +
"'.";
326 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.
@ rpcCHANNEL_AMT_MALFORMED
@ rpcEXPIRED_VALIDATOR_LIST
@ rpcREPORTING_UNSUPPORTED
warning_code_i
Codes returned in the warnings array of certain RPC commands.
@ warnRPC_EXPIRED_VALIDATOR_LIST
@ 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_)