Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-lsp/src/lib.rs')
| -rw-r--r-- | helix-lsp/src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 450a3769..d01cd399 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -37,7 +37,7 @@ pub enum Error { #[error("protocol error: {0}")] Rpc(#[from] jsonrpc::Error), #[error("failed to parse: {0}")] - Parse(#[from] serde_json::Error), + Parse(Box<dyn std::error::Error + Send + Sync>), #[error("IO Error: {0}")] IO(#[from] std::io::Error), #[error("request {0} timed out")] @@ -52,6 +52,18 @@ pub enum Error { Other(#[from] anyhow::Error), } +impl From<serde_json::Error> for Error { + fn from(value: serde_json::Error) -> Self { + Self::Parse(Box::new(value)) + } +} + +impl From<sonic_rs::Error> for Error { + fn from(value: sonic_rs::Error) -> Self { + Self::Parse(Box::new(value)) + } +} + #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum OffsetEncoding { /// UTF-8 code units aka bytes |