use thiserror::Error;
pub type AgentResult<T> = Result<T, AgentError>;
#[derive(Debug, Error)]
pub enum AgentError {
#[error("registry actor is closed")]
RegistryClosed,
#[error("registry actor failed: {0}")]
Actor(String),
#[error("invalid job name")]
InvalidJobName,
#[error("job already exists: {0}")]
JobAlreadyExists(String),
#[error("job not found: {0}")]
JobNotFound(String),
#[error("job is already running: {0}")]
JobAlreadyRunning(String),
#[error("job is not running: {0}")]
JobNotRunning(String),
#[error("job does not support graceful drain: {0}")]
DrainUnsupported(String),
#[error("restart limit exceeded for job: {0}")]
RestartLimitExceeded(String),
#[error(transparent)]
Stream(#[from] datum::StreamError),
}