1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error("Claude Code not found in PATH")]
6 BinaryNotFound,
7
8 #[error("Session {0} not found")]
9 SessionNotFound(String),
10
11 #[error("Tool permission denied: {0}")]
12 PermissionDenied(String),
13
14 #[error("MCP server error: {0}")]
15 McpError(String),
16
17 #[error("Invalid configuration: {0}")]
18 ConfigError(String),
19
20 #[error("Invalid input: {0}")]
21 InvalidInput(String),
22
23 #[error("Operation timed out after {0}s")]
24 Timeout(u64),
25
26 #[error("Serialization error: {0}")]
27 SerializationError(#[from] serde_json::Error),
28
29 #[error("IO error: {0}")]
30 Io(#[from] std::io::Error),
31
32 #[error("Process error: {0}")]
33 ProcessError(String),
34
35 #[error("Stream closed unexpectedly")]
36 StreamClosed,
37}
38
39pub type Result<T> = std::result::Result<T, Error>;