#[non_exhaustive]pub enum Error {
Show 35 variants
LspInitFailed {
message: String,
},
LspServerError {
code: i32,
message: String,
data: Option<Value>,
},
McpServer(String),
DocumentNotFound(PathBuf),
NoServerForLanguage(String),
NoServerForTool {
language_id: String,
tool: ToolKind,
},
ServerInitializing {
server_id: ServerId,
},
WorkspaceServersInitializing,
NoServerConfigured,
NoServerForWorkspaceTool {
tool: ToolKind,
},
Config(String),
ConfigNotFound(PathBuf),
InvalidConfig(String),
Io(Error),
Json(Error),
TomlDe(Error),
TomlSer(Error),
Transport(String),
Timeout(u64),
Shutdown,
ServerSpawnFailed {
command: String,
source: Error,
},
LspProtocolError(String),
InvalidUri(String),
EncodingError(String),
ServerTerminated,
ServerUnavailable {
server_id: ServerId,
reason: String,
},
InvalidToolParams(String),
FileIo {
path: PathBuf,
source: Error,
},
PathOutsideWorkspace(PathBuf),
DocumentLimitExceeded {
current: usize,
max: usize,
},
FileSizeLimitExceeded {
size: u64,
max: u64,
},
PartialServerInit {
failed_count: usize,
total_count: usize,
failures: Vec<ServerSpawnFailure>,
},
AllServersFailedToInit {
count: usize,
failures: Vec<ServerSpawnFailure>,
},
NoServersAvailable(String),
CapabilityNotSupported {
server_id: ServerId,
capability: &'static str,
},
}Expand description
The main error type for mcpls-core operations.
This enum is #[non_exhaustive]: downstream crates that match on it must
include a wildcard arm. New variants (such as Error::ServerInitializing)
can then be added without further breaking changes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LspInitFailed
LSP server failed to initialize.
LspServerError
LSP server returned an error response.
Fields
McpServer(String)
MCP server error.
DocumentNotFound(PathBuf)
Document was not found or could not be opened.
NoServerForLanguage(String)
No LSP server configured for the given language.
NoServerForTool
A server is configured for the language, but no server claims this
specific tool (either no server lists it in handles and there is no
catch-all, or the server that claimed it failed to spawn with no live
catch-all to rebind to).
Fields
ServerInitializing
LSP server for the language is configured but still initializing.
WorkspaceServersInitializing
A workspace-wide tool (one with no file to resolve a language from,
e.g. workspace_symbol_search) could not be routed because at least
one expected LSP server has not registered yet. Unlike
Error::ServerInitializing, resolution never narrowed down to a
single candidate server, so no server_id is available.
NoServerConfigured
No LSP server is currently configured.
NoServerForWorkspaceTool
At least one server is configured somewhere in the workspace, but
none of them claims a workspace-wide tool that has no file to
resolve a language from (e.g. workspace_symbol_search). The
language-less counterpart of Error::NoServerForTool.
Config(String)
Configuration error.
ConfigNotFound(PathBuf)
Configuration file not found.
InvalidConfig(String)
Invalid configuration format.
Io(Error)
I/O error.
Json(Error)
JSON serialization/deserialization error.
TomlDe(Error)
TOML deserialization error.
TomlSer(Error)
TOML serialization error.
Transport(String)
LSP client transport error.
Timeout(u64)
Request timeout.
Shutdown
Server shutdown requested.
ServerSpawnFailed
LSP server failed to spawn.
LspProtocolError(String)
LSP protocol error during message parsing.
InvalidUri(String)
Invalid URI format.
EncodingError(String)
Position encoding error.
ServerTerminated
Server process terminated unexpectedly.
A crashed server could not be automatically respawned.
Distinct from Self::ServerTerminated so a caller (or a log
reader) can tell “the connection just died” apart from “mcpls tried
to bring it back and could not” – e.g. no respawn config was ever
registered for it, or it is crash-looping and is being backed off.
InvalidToolParams(String)
Invalid tool parameters provided.
FileIo
File I/O error occurred.
PathOutsideWorkspace(PathBuf)
Path is outside allowed workspace boundaries.
DocumentLimitExceeded
Document limit exceeded.
FileSizeLimitExceeded
File size limit exceeded.
PartialServerInit
Partial server initialization - some servers failed but at least one succeeded.
Fields
failures: Vec<ServerSpawnFailure>Details of each failure.
AllServersFailedToInit
All configured LSP servers failed to initialize.
Fields
failures: Vec<ServerSpawnFailure>Details of each failure.
NoServersAvailable(String)
No LSP servers available (none configured or all failed).
CapabilityNotSupported
The server routed for this request does not advertise support for the
requested LSP capability (e.g. no renameProvider in its
ServerCapabilities).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()