Skip to main content

aether_lspd/
error.rs

1use std::io;
2use std::time::Duration;
3use thiserror::Error;
4
5#[doc = include_str!("docs/daemon_error.md")]
6#[derive(Debug, Error)]
7pub enum DaemonError {
8    /// IO error
9    #[error("IO error: {0}")]
10    Io(#[from] io::Error),
11
12    /// Failed to bind to socket
13    #[error("Failed to bind to socket: {0}")]
14    BindFailed(#[source] io::Error),
15
16    /// Failed to spawn LSP process
17    #[error("Failed to spawn LSP: {0}")]
18    LspSpawnFailed(String),
19
20    /// The LSP process exited or rejected `initialize` before completing the handshake
21    #[error("Language server failed to complete initialization (it exited or rejected `initialize`)")]
22    LspInitializeFailed,
23
24    /// The LSP process never answered `initialize`
25    #[error("Language server did not answer `initialize` within {}s", .0.as_secs())]
26    LspInitializeTimedOut(Duration),
27
28    /// Lockfile error
29    #[error("Lockfile error: {0}")]
30    LockfileError(#[source] io::Error),
31}
32
33/// Result type for daemon operations
34pub type DaemonResult<T> = std::result::Result<T, DaemonError>;