pub struct Error {
pub code: i32,
pub message: String,
pub data: Option<Value>,
}Expand description
Error object returned in response to a failed RPC call.
Fields§
§code: i32Error code indicating the error type.
message: StringShort error description.
data: Option<Value>Additional information about the error.
Implementations§
Source§impl Error
impl Error
pub const PARSE_ERROR: i32 = -32_700i32
pub const INVALID_REQUEST: i32 = -32_600i32
pub const METHOD_NOT_FOUND: i32 = -32_601i32
pub const INVALID_PARAMS: i32 = -32_602i32
pub const INTERNAL_ERROR: i32 = -32_603i32
pub const BAD_REQUEST: i32 = -32_000i32
pub const BAD_RESPONSE: i32 = -32_001i32
pub const REMOTE_DISCONNECTED: i32 = -32_002i32
Sourcepub fn with_data(code: i32, message: String, data: Option<Value>) -> Self
pub fn with_data(code: i32, message: String, data: Option<Value>) -> Self
Creates a new error object with additional information.
Sourcepub fn invalid_params() -> Self
pub fn invalid_params() -> Self
Creates a new error object indicating invalid method parameters.
Sourcepub fn method_not_found() -> Self
pub fn method_not_found() -> Self
Creates a new error object indicating that the method does not exist.
pub fn invalid_args_len(n: usize) -> Self
pub fn bad_response() -> Self
pub fn bad_request() -> Self
pub fn remote_disconnected() -> Self
pub fn is_disconnnected(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
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 Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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