#[derive(Debug, thiserror::Error)]
pub enum PipelineError {
#[error("{context}: {source}")]
Toml {
context: String,
#[source]
source: basic_toml::Error,
},
#[error("{context}: {source}")]
Io {
context: String,
#[source]
source: std::io::Error,
},
#[error("{0}")]
Logic(String),
}
impl PipelineError {
pub fn toml(context: impl Into<String>, source: basic_toml::Error) -> Self {
Self::Toml {
context: context.into(),
source,
}
}
pub fn io(context: impl Into<String>, source: std::io::Error) -> Self {
Self::Io {
context: context.into(),
source,
}
}
pub fn logic(msg: impl Into<String>) -> Self {
Self::Logic(msg.into())
}
}
impl From<PipelineError> for kernex_core::error::KernexError {
fn from(err: PipelineError) -> Self {
kernex_core::error::KernexError::pipeline(err)
}
}