use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ContainerError {
#[error("docker error: {0}")]
Docker(#[from] bollard::errors::Error),
#[error("container not found: {0}")]
NotFound(String),
#[error("container already exists: {0}")]
AlreadyExists(String),
#[error("image not allowed: {image} (allowed: {allowed:?})")]
ImageNotAllowed { image: String, allowed: Vec<String> },
#[error("invalid state for container {id}: expected {expected}, got {actual}")]
InvalidState {
id: String,
expected: String,
actual: String,
},
#[error("agent error: {0}")]
Agent(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
}
pub type ContainerResult<T> = Result<T, ContainerError>;