use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("step job is missing header `{0}`")]
MissingHeader(&'static str),
#[error("step job has invalid `{header}` header `{value}`")]
InvalidStepHeader {
header: &'static str,
value: String,
},
#[error("submission header `{0}` uses the reserved `workflow.*` prefix")]
ReservedHeaderInSubmit(String),
#[error("run `{0}` is already active in this runtime")]
DuplicateRun(String),
#[error(transparent)]
Queue(#[from] taquba::Error),
}
impl Error {
pub(crate) fn is_permanent(&self) -> bool {
matches!(
self,
Error::MissingHeader(_) | Error::InvalidStepHeader { .. }
)
}
}
pub type Result<T> = std::result::Result<T, Error>;