|
xrpld
|
Status represents the results of an operation that might fail. More...
#include <Status.h>


Public Types | |
| enum class | Type { None , TER , ErrorCodeI } |
| using | Code = int |
| using | Strings = std::vector<std::string> |
Public Member Functions | |
| Status ()=default | |
| template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>> | |
| Status (T code, Strings d={}) | |
| Status (TER ter, Strings d={}) | |
| Status (ErrorCodeI e, Strings d={}) | |
| Status (ErrorCodeI e, std::string const &s) | |
| std::string | codeString () const |
| operator bool () const | |
| Returns true if the Status is not OK. | |
| bool | operator! () const |
| Returns true if the Status is OK. | |
| TER | toTER () const |
| Returns the Status as a TER. | |
| ErrorCodeI | toErrorCode () const |
| Returns the Status as an error_code_i. | |
| void | inject (json::Value &object) const |
| Apply the Status to a JsonObject. | |
| Strings const & | messages () const |
| std::string | message () const |
| Return the first message, if any. | |
| Type | type () const |
| std::string | toString () const |
| void | fillJson (json::Value &) |
| Fill a json::Value with an RPC 2.0 response. | |
| T | what (T... args) |
Static Public Attributes | |
| static constexpr Code | kOK = 0 |
Private Attributes | |
| Type | type_ = Type::None |
| Code | code_ = kOK |
| Strings | messages_ |
Status represents the results of an operation that might fail.
It wraps the legacy codes TER and error_code_i, providing both a uniform interface and a way to attach additional information to existing status returns.
A Status can also be used to fill a json::Value with a JSON-RPC 2.0 error response: see http://www.jsonrpc.org/specification#error_object
| using xrpl::RPC::Status::Code = int |
|
strong |
|
default |
| xrpl::RPC::Status::Status | ( | T | code, |
| Strings | d = {} ) |
| xrpl::RPC::Status::Status | ( | ErrorCodeI | e, |
| Strings | d = {} ) |
| xrpl::RPC::Status::Status | ( | ErrorCodeI | e, |
| std::string const & | s ) |
|
nodiscard |
Definition at line 15 of file Status.cpp.
| xrpl::RPC::Status::operator bool | ( | ) | const |
| bool xrpl::RPC::Status::operator! | ( | ) | const |
|
nodiscard |
|
nodiscard |
Returns the Status as an error_code_i.
This may only be called if type() == Type::ErrorCodeI.
| void xrpl::RPC::Status::inject | ( | json::Value & | object | ) | const |
|
nodiscard |
|
nodiscard |
Return the first message, if any.
Definition at line 67 of file Status.cpp.
|
nodiscard |
Definition at line 81 of file Status.cpp.
| void xrpl::RPC::Status::fillJson | ( | json::Value & | value | ) |
Fill a json::Value with an RPC 2.0 response.
If the Status is OK, fillJson has no effect. Not currently used.
Definition at line 48 of file Status.cpp.
|
private |