Struct ez_jsonrpc_types::Error
source · pub struct Error<T = Value> {
pub code: i64,
pub message: String,
pub data: Option<T>,
}
Expand description
A JSON-RPC 2.0
error object.
Fields§
§code: i64
A Number that indicates the error type that occurred. This MUST be an integer.
See the associated constants for error types defined by the specification.
message: String
A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.
data: Option<T>
A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).
Implementations§
source§impl Error
impl Error
sourcepub const PARSE_ERROR: i64 = -32_700i64
pub const PARSE_ERROR: i64 = -32_700i64
Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
sourcepub const INVALID_REQUEST: i64 = -32_600i64
pub const INVALID_REQUEST: i64 = -32_600i64
The JSON sent is not a valid Request object.
sourcepub const METHOD_NOT_FOUND: i64 = -32_601i64
pub const METHOD_NOT_FOUND: i64 = -32_601i64
The method does not exist / is not available.
sourcepub const INVALID_PARAMS: i64 = -32_602i64
pub const INVALID_PARAMS: i64 = -32_602i64
Invalid method parameter(s).
sourcepub const INTERNAL_ERROR: i64 = -32_603i64
pub const INTERNAL_ERROR: i64 = -32_603i64
Internal JSON-RPC error.
source§impl<T> Error<T>
impl<T> Error<T>
sourcepub fn parse_error(message: impl Display, data: impl Into<Option<T>>) -> Self
pub fn parse_error(message: impl Display, data: impl Into<Option<T>>) -> Self
Convenience method for creating a new error with code Self::PARSE_ERROR
sourcepub fn invalid_request(
message: impl Display,
data: impl Into<Option<T>>,
) -> Self
pub fn invalid_request( message: impl Display, data: impl Into<Option<T>>, ) -> Self
Convenience method for creating a new error with code Self::INVALID_REQUEST
sourcepub fn method_not_found(
message: impl Display,
data: impl Into<Option<T>>,
) -> Self
pub fn method_not_found( message: impl Display, data: impl Into<Option<T>>, ) -> Self
Convenience method for creating a new error with code Self::METHOD_NOT_FOUND
sourcepub fn invalid_params(message: impl Display, data: impl Into<Option<T>>) -> Self
pub fn invalid_params(message: impl Display, data: impl Into<Option<T>>) -> Self
Convenience method for creating a new error with code Self::INVALID_PARAMS
sourcepub fn internal_error(message: impl Display, data: impl Into<Option<T>>) -> Self
pub fn internal_error(message: impl Display, data: impl Into<Option<T>>) -> Self
Convenience method for creating a new error with code Self::INTERNAL_ERROR
sourcepub const fn spec_message(&self) -> Option<&'static str>
pub const fn spec_message(&self) -> Option<&'static str>
If Self::code
is one of the predefined errors in the spec,
get its associated error message.
source§impl Error
impl Error
sourcepub const SERVER_ERROR_RANGE: RangeInclusive<i64> = _
pub const SERVER_ERROR_RANGE: RangeInclusive<i64> = _
Reserved for implementation-defined server-errors.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Error<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Error<T>where
T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T> Error for Error<T>where
T: Debug,
impl<T> Error for Error<T>where
T: Debug,
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl<T: PartialEq> PartialEq for Error<T>
impl<T: PartialEq> PartialEq for Error<T>
impl<T: Eq> Eq for Error<T>
impl<T> StructuralPartialEq for Error<T>
Auto Trait Implementations§
impl<T> Freeze for Error<T>where
T: Freeze,
impl<T> RefUnwindSafe for Error<T>where
T: RefUnwindSafe,
impl<T> Send for Error<T>where
T: Send,
impl<T> Sync for Error<T>where
T: Sync,
impl<T> Unpin for Error<T>where
T: Unpin,
impl<T> UnwindSafe for Error<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)