pub enum LspError {
Internal(String),
InvalidParams(String),
MethodNotFound(String),
RequestCancelled,
ContentModified,
ServerNotInitialized,
InvalidRequest(String),
ServerError {
code: i32,
message: String,
data: Option<Value>,
},
}Expand description
A JSON-RPC/LSP error suitable for returning from a handler.
Variants§
Internal(String)
An unexpected server failure (-32603).
InvalidParams(String)
Invalid method parameters (-32602).
MethodNotFound(String)
No handler exists for the method (-32601).
RequestCancelled
The peer cancelled the request (-32800).
ContentModified
The requested content changed before completion (-32801).
ServerNotInitialized
A request arrived before initialization completed (-32002).
InvalidRequest(String)
The incoming JSON-RPC request is invalid (-32600).
ServerError
An application-defined server error.
Implementations§
Source§impl LspError
impl LspError
Sourcepub fn internal(e: impl Display) -> Self
pub fn internal(e: impl Display) -> Self
Construct an internal-error response from a displayable value.
Sourcepub fn invalid_params(e: impl Display) -> Self
pub fn invalid_params(e: impl Display) -> Self
Construct an invalid-params response from a displayable value.
Sourcepub fn invalid_request(e: impl Display) -> Self
pub fn invalid_request(e: impl Display) -> Self
Construct an invalid-request response from a displayable value.
Trait Implementations§
Source§impl Error for LspError
impl Error for LspError
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 LspError
impl RefUnwindSafe for LspError
impl Send for LspError
impl Sync for LspError
impl Unpin for LspError
impl UnsafeUnpin for LspError
impl UnwindSafe for LspError
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