ricecoder_external_lsp/
error.rs

1//! Error types for external LSP integration
2
3use thiserror::Error;
4
5/// Errors that can occur in external LSP operations
6#[derive(Debug, Error)]
7pub enum ExternalLspError {
8    #[error("LSP server not found: {executable}")]
9    ServerNotFound { executable: String },
10
11    #[error("Failed to spawn LSP server: {0}")]
12    SpawnFailed(#[from] std::io::Error),
13
14    #[error("LSP server crashed: {reason}")]
15    ServerCrashed { reason: String },
16
17    #[error("Request timeout after {timeout_ms}ms")]
18    Timeout { timeout_ms: u64 },
19
20    #[error("Protocol error: {0}")]
21    ProtocolError(String),
22
23    #[error("Initialization failed: {0}")]
24    InitializationFailed(String),
25
26    #[error("Configuration error: {0}")]
27    ConfigError(String),
28
29    #[error("No LSP server configured for language: {language}")]
30    NoServerForLanguage { language: String },
31
32    #[error("JSON path error: {0}")]
33    JsonPathError(String),
34
35    #[error("Transformation error: {0}")]
36    TransformationError(String),
37
38    #[error("Storage error: {0}")]
39    StorageError(String),
40
41    #[error("Invalid configuration: {0}")]
42    InvalidConfiguration(String),
43}
44
45/// Result type for external LSP operations
46pub type Result<T> = std::result::Result<T, ExternalLspError>;