1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, DockerError>;
7
8#[derive(Debug, Error)]
10pub enum DockerError {
11 #[error("Docker image pull failed for '{image}': {reason}")]
12 ImagePullFailed { image: String, reason: String },
13
14 #[error("Docker command failed: {message}\nstderr: {stderr}")]
15 CommandFailed { message: String, stderr: String },
16
17 #[error("Operation timed out after {seconds}s: {operation}")]
18 Timeout { seconds: f64, operation: String },
19
20 #[error("Container not started — call start() first")]
21 NotStarted,
22
23 #[error("Session '{0}' already exists")]
24 SessionExists(String),
25
26 #[error("Session '{0}' not found")]
27 SessionNotFound(String),
28
29 #[error("Command exited with code {exit_code}: {command}\n{output}")]
30 NonZeroExit {
31 exit_code: i32,
32 command: String,
33 output: String,
34 },
35
36 #[error("Connection error to {host}:{port} — {reason}")]
37 ConnectionFailed {
38 host: String,
39 port: u16,
40 reason: String,
41 },
42
43 #[error("{0}")]
44 Other(String),
45}