#[derive(thiserror::Error, Debug)]
pub enum TestError {
#[error("Startup problem: {0}")]
Startup(String),
#[error("Low level I/O problem: {0}")]
Io(#[from] std::io::Error),
#[error("Low level Docker problem: {0}")]
Docker(#[from] DockerError),
#[error("Configuration not supported: {0}")]
NotSupportedConfig(String),
#[error("Unknown service of type `{0}`")]
UnknownService(&'static str),
#[error("Unknown service hostname `{0}`")]
UnknownServiceHostname(String),
#[error("Unavailable runtime: {0}")]
UnavailableRuntime(#[from] UnavailableRuntimeError),
#[error("Multithread runtime required")]
UnavailableMultiThread,
#[error("Unable to pick new ports")]
UnavailablePorts,
#[error("Unable to connect to docker daemon.")]
UnavailableDocker(DockerError),
#[error("Can not retrieve credentials. Reason: `{0}`")]
CredentialRetrieval(#[from] CredentialRetrievalError),
}
#[derive(thiserror::Error, Debug)]
#[error(transparent)]
pub struct CredentialRetrievalError(#[from] docker_credential::CredentialRetrievalError);
impl From<docker_credential::CredentialRetrievalError> for TestError {
fn from(value: docker_credential::CredentialRetrievalError) -> Self {
CredentialRetrievalError(value).into()
}
}
#[derive(thiserror::Error, Debug)]
#[error(transparent)]
pub struct DockerError(#[from] bollard::errors::Error);
impl From<bollard::errors::Error> for TestError {
fn from(value: bollard::errors::Error) -> Self {
DockerError(value).into()
}
}
#[derive(thiserror::Error, Debug)]
#[error(transparent)]
pub struct UnavailableRuntimeError(#[from] tokio::runtime::TryCurrentError);
impl From<tokio::runtime::TryCurrentError> for TestError {
fn from(value: tokio::runtime::TryCurrentError) -> Self {
UnavailableRuntimeError(value).into()
}
}