20 #ifndef RIPPLE_PROTOCOL_ERRORCODES_H_INCLUDED
21 #define RIPPLE_PROTOCOL_ERRORCODES_H_INCLUDED
23 #include <ripple/json/json_value.h>
24 #include <ripple/protocol/jss.h>
173 ,
message(
"An unknown error code.")
181 char const* message_)
189 char const* message_,
210 template <
class JsonValue>
215 json[jss::error] = info.
token;
216 json[jss::error_code] = info.
code;
217 json[jss::error_message] = info.
message;
220 template <
class JsonValue>
227 template <
class JsonValue>
232 json[jss::error] = info.
token;
233 json[jss::error_code] = info.
code;
234 json[jss::error_message] = message;
258 return "Missing field '" + name +
"'.";
276 return "Invalid field '" + name +
"', not object.";
294 return "Invalid field '" + name +
"'.";
318 return "Invalid field '" + name +
"', not " + type +
".";
ErrorInfo const & get_error_info(error_code_i code)
Returns an ErrorInfo that reflects the error code.
std::string missing_field_message(std::string const &name)
std::string rpcErrorString(Json::Value const &jv)
Returns a single string with the contents of an RPC error.
@ rpcREPORTING_UNSUPPORTED
Json::Value object_field_error(std::string const &name)
Json::Value expected_field_error(std::string const &name, std::string const &type)
Json::Value missing_field_error(std::string const &name)
Json::StaticString message
std::string expected_field_message(std::string const &name, std::string const &type)
@ warnRPC_AMENDMENT_BLOCKED
std::string object_field_message(std::string const &name)
bool contains_error(Json::Value const &json)
Returns true if the json contains an rpc error specification.
warning_code_i
Codes returned in the warnings array of certain RPC commands.
@ warnRPC_EXPIRED_VALIDATOR_LIST
@ warnRPC_UNSUPPORTED_MAJORITY
Maps an rpc error code to its token, default message, and HTTP status.
Json::Value not_validator_error()
constexpr ErrorInfo(error_code_i code_, char const *token_, char const *message_, int http_status_)
@ rpcCHANNEL_AMT_MALFORMED
std::string invalid_field_message(std::string const &name)
int error_code_http_status(error_code_i code)
Returns http status that corresponds to the error code.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Lightweight wrapper to tag static string.
Json::Value make_param_error(std::string const &message)
Returns a new json object that indicates invalid parameters.
constexpr ErrorInfo(error_code_i code_, char const *token_, char const *message_)
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Json::Value invalid_field_error(std::string const &name)
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
@ rpcEXPIRED_VALIDATOR_LIST