pub struct RpcError {
pub code: i32,
pub message: String,
pub data: Option<Value>,
}Expand description
A JSON-RPC 2.0 error object (§5.1), plus a small implementation-defined custom range this protocol occupies for its own conditions.
Fields§
§code: i32§message: String§data: Option<Value>Implementations§
Source§impl RpcError
impl RpcError
pub const PARSE_ERROR: i32 = -32700
pub const INVALID_REQUEST: i32 = -32600
pub const METHOD_NOT_FOUND: i32 = -32601
pub const INVALID_PARAMS: i32 = -32602
pub const INTERNAL_ERROR: i32 = -32603
Sourcepub const NOT_SUPPORTED: i32 = -32000
pub const NOT_SUPPORTED: i32 = -32000
JSON-RPC 2.0 reserves -32000..=-32099 for implementation-defined
server errors (§5.1). NOT_SUPPORTED is the first occupant — a
capability-gated method (e.g. screenshot) rejects with it on a
server whose handshake declared no matching crate::Capability.
Sourcepub const UNAUTHORIZED: i32 = -32001
pub const UNAUTHORIZED: i32 = -32001
The second occupant of the implementation-defined range: the
connection has not presented the server’s per-process token
(crate::HandshakeParams), so no method but handshake is
dispatched. A client that receives this has the wrong token, or none —
it must re-read the discovery line, never retry blindly.
pub fn new(code: i32, message: impl Into<String>) -> Self
pub fn not_supported(message: impl Into<String>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RpcError
impl<'de> Deserialize<'de> for RpcError
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
impl StructuralPartialEq for RpcError
Auto Trait Implementations§
impl Freeze for RpcError
impl RefUnwindSafe for RpcError
impl Send for RpcError
impl Sync for RpcError
impl Unpin for RpcError
impl UnsafeUnpin for RpcError
impl UnwindSafe for RpcError
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