pub struct Error {
pub code: i32,
pub message: String,
pub data: Option<Value>,
}Expand description
JSON-RPC error object
Fields§
§code: i32A number that indicates the error type that occurred
message: StringA short description of the error
data: Option<Value>Additional information about the error
Implementations§
Source§impl Error
impl Error
Sourcepub fn with_data(code: i32, message: String, data: Value) -> Error
pub fn with_data(code: i32, message: String, data: Value) -> Error
Create a new error with code, message, and data
Sourcepub fn parse_error() -> Error
pub fn parse_error() -> Error
Parse error (-32700)
Sourcepub fn invalid_request() -> Error
pub fn invalid_request() -> Error
Invalid request error (-32600)
Sourcepub fn method_not_found() -> Error
pub fn method_not_found() -> Error
Method not found error (-32601)
Sourcepub fn invalid_params() -> Error
pub fn invalid_params() -> Error
Invalid params error (-32602)
Sourcepub fn internal_error() -> Error
pub fn internal_error() -> Error
Internal error (-32603)
Sourcepub fn server_error(code: i32, message: String) -> Error
pub fn server_error(code: i32, message: String) -> Error
Server error (-32000 to -32099)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Error
impl Serialize for Error
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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