use std::time::Duration;
pub type Result<T> = std::result::Result<T, RuntimeError>;
#[derive(Debug, thiserror::Error)]
pub enum RuntimeError {
#[error("failed to connect to the container runtime")]
Connect(#[source] bollard::errors::Error),
#[error("failed to pull image `{image}`")]
ImagePull {
image: String,
#[source]
source: bollard::errors::Error,
},
#[error("failed to start container")]
Start(#[source] bollard::errors::Error),
#[error("failed to stop container `{id}`")]
Stop {
id: String,
#[source]
source: bollard::errors::Error,
},
#[error("failed to remove container `{name}`")]
Remove {
name: String,
#[source]
source: bollard::errors::Error,
},
#[error("failed to inspect container `{id}`")]
Inspect {
id: String,
#[source]
source: bollard::errors::Error,
},
#[error("container `{0}` not found")]
NotFound(String),
#[error("operation `{operation}` timed out after {after:?}")]
Timeout {
operation: &'static str,
after: Duration,
},
#[error("log stream error")]
LogStream(#[source] bollard::errors::Error),
#[error("failed to build image from Dockerfile")]
Build(#[source] bollard::errors::Error),
#[error("invalid container spec: {0}")]
InvalidSpec(String),
}