pub struct Error {
pub code: ErrorCode,
pub message: Cow<'static, str>,
pub data: Option<Value>,
}
Expand description
A JSON-RPC error object.
Fields§
§code: ErrorCode
A number indicating the error type that occurred.
message: Cow<'static, str>
A short description of the error.
data: Option<Value>
Additional information about the error, if any.
Implementations§
source§impl Error
impl Error
sourcepub const fn parse_error() -> Self
pub const fn parse_error() -> Self
Creates a new parse error (-32700
).
sourcepub const fn invalid_request() -> Self
pub const fn invalid_request() -> Self
Creates a new “invalid request” error (-32600
).
sourcepub const fn method_not_found() -> Self
pub const fn method_not_found() -> Self
Creates a new “method not found” error (-32601
).
sourcepub fn invalid_params<M>(message: M) -> Self
pub fn invalid_params<M>(message: M) -> Self
Creates a new “invalid params” error (-32602
).
sourcepub const fn internal_error() -> Self
pub const fn internal_error() -> Self
Creates a new internal error (-32603
).
sourcepub const fn request_cancelled() -> Self
pub const fn request_cancelled() -> Self
Creates a new “request cancelled” error (-32800
).
§Compatibility
This error code is defined by the Language Server Protocol.
sourcepub const fn content_modified() -> Self
pub const fn content_modified() -> Self
Creates a new “content modified” error (-32801
).
§Compatibility
This error code is defined by the Language Server Protocol.
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()
impl Eq for Error
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 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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.