Skip to main content

dscode_extension_host/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in extension host operations.
4#[derive(Error, Debug)]
5pub enum ExtensionHostError {
6    /// Failed to spawn the extension host process.
7    #[error("Extension host spawn failed: {0}")]
8    SpawnFailed(String),
9    /// IPC communication error with the extension host.
10    #[error("IPC connection error: {0}")]
11    IpcError(String),
12    /// The requested extension was not found.
13    #[error("Extension not found: {0}")]
14    ExtensionNotFound(String),
15    /// The extension is already loaded and cannot be loaded again.
16    #[error("Extension already loaded: {0}")]
17    AlreadyLoaded(String),
18    /// Sandbox configuration or application error.
19    #[error("Sandbox error: {0}")]
20    SandboxError(String),
21    /// Path validation failed (traversal attack or outside workspace).
22    #[error("Path validation failed: {0}")]
23    PathValidation(String),
24    /// The extension does not have the required permission.
25    #[error("Permission denied: {0}")]
26    PermissionDenied(String),
27    /// The extension has exceeded its rate limit.
28    #[error("Rate limit exceeded")]
29    RateLimited,
30    /// Secret storage operation failed.
31    #[error("Secret storage error: {0}")]
32    SecretError(String),
33    /// Invalid state transition for the extension host.
34    #[error("Invalid state: {from} -> {to}")]
35    InvalidState { from: String, to: String },
36}