#[non_exhaustive]pub struct ResponseError {
pub code: ErrorCode,
pub message: String,
pub data: Option<Value>,
}
Expand description
The error object in case a request fails.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.code: ErrorCode
A number indicating the error type that occurred.
message: String
A string providing a short description of the error.
data: Option<Value>
A primitive or structured value that contains additional information about the error. Can be omitted.
Implementations§
Source§impl ResponseError
impl ResponseError
Sourcepub fn new(code: ErrorCode, message: impl Display) -> Self
pub fn new(code: ErrorCode, message: impl Display) -> Self
Create a new error object with a JSON-RPC error code and a message.
Sourcepub fn new_with_data(
code: ErrorCode,
message: impl Display,
data: JsonValue,
) -> Self
pub fn new_with_data( code: ErrorCode, message: impl Display, data: JsonValue, ) -> Self
Create a new error object with a JSON-RPC error code, a message, and any additional data.
Trait Implementations§
Source§impl Clone for ResponseError
impl Clone for ResponseError
Source§fn clone(&self) -> ResponseError
fn clone(&self) -> ResponseError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ResponseError
impl Debug for ResponseError
Source§impl<'de> Deserialize<'de> for ResponseError
impl<'de> Deserialize<'de> for ResponseError
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ResponseError
impl Display for ResponseError
Source§impl Error for ResponseError
impl Error for ResponseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ResponseError> for Error
impl From<ResponseError> for Error
Source§fn from(source: ResponseError) -> Self
fn from(source: ResponseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ResponseError
impl RefUnwindSafe for ResponseError
impl Send for ResponseError
impl Sync for ResponseError
impl Unpin for ResponseError
impl UnwindSafe for ResponseError
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
Mutably borrows from an owned value. Read more