|
JSON RPC
JSON-RPC 2.0 library for C++
|
JSON RPC Exception class. More...
#include <exception.h>
Public Member Functions | |
| exception (const exception &)=default | |
| Default copy constructor. | |
| exception (exception &&)=default | |
| Default move constructor. | |
| exception (int code, std::string_view message) | |
| Construct a new exception object. | |
| template<typename T> | |
| exception (int code, std::string_view message, const T &data) | |
| Construct a new exception object with additional data. | |
| ~exception () override | |
| Default destructor. | |
| int | code () const noexcept |
| Returns the error code. | |
| const nlohmann::json & | data () const noexcept |
| Returns custom data associated with the error. | |
| const std::string & | message () const noexcept |
| Returns the error message. | |
| exception & | operator= (const exception &rhs)=default |
| Default copy assignment operator. | |
| exception & | operator= (exception &&rhs)=default |
| Default move assignment operator. | |
| nlohmann::json | to_json () const |
| Returns the error message as an Error Object. | |
| const char * | what () const noexcept override |
| Returns the error message. | |
Static Public Attributes | |
| static constexpr int | INTERNAL_ERROR = -32603 |
| Internal JSON-RPC error. | |
| static constexpr int | INVALID_PARAMS = -32602 |
| Invalid method parameter(s). | |
| static constexpr int | INVALID_REQUEST = -32600 |
| The JSON sent is not a valid Request object. | |
| static constexpr int | METHOD_NOT_FOUND = -32601 |
| The method does not exist or is not available. | |
| static constexpr int | PARSE_ERROR = -32700 |
| Invalid JSON was received by the server. | |
Private Attributes | |
| int | m_code |
| Error code. | |
| nlohmann::json | m_data |
| Custom data associated with the error. | |
| std::string | m_message |
| Error message. | |
JSON RPC Exception class.
This class represents an exception that can occur during the processing of JSON RPC requests. It includes an error code, a message, and optional additional data.
Definition at line 86 of file exception.h.
|
inline |
Construct a new exception object with additional data.
| T | Type of the data. Must be convertible to nlohmann::json. |
| code | Indicates the error type that occurred. |
| message | Provides a short description of the error. The message SHOULD be limited to a concise single sentence. |
| data | Additional information about the error. |
Definition at line 134 of file exception.h.
|
inline |
Construct a new exception object.
| code | Indicates the error type that occurred. |
| message | Provides a short description of the error. The message SHOULD be limited to a concise single sentence. |
Definition at line 145 of file exception.h.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
overridedefault |
Default destructor.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Returns custom data associated with the error.
Definition at line 197 of file exception.h.
|
inlinenodiscardnoexcept |
Default copy assignment operator.
| rhs | Right-hand side of the assignment. |
Default move assignment operator.
| rhs | Right-hand side of the assignment. |
|
inlinenodiscard |
Returns the error message as an Error Object.
Definition at line 215 of file exception.h.
|
inlinenodiscardoverridenoexcept |
Returns the error message.
Definition at line 207 of file exception.h.
|
private |
Error code.
Definition at line 232 of file exception.h.
|
private |
Custom data associated with the error.
Definition at line 231 of file exception.h.
|
private |
Error message.
Definition at line 230 of file exception.h.