crates/knut-thund/src/error.rs
//! Error types for the Þund engine.
use thiserror::Error;
/// Result alias for the crate.
pub type Result<T> = std::result::Result<T, ThundError>;
/// Anything that can go wrong building, lowering, or running a pipeline.
#[derive(Debug, Error)]
pub enum ThundError {
/// Two datasets or two flows share a name.
#[error("duplicate {kind} name: {name}")]
DuplicateName {
/// `"dataset"` or `"flow"`.
kind: &'static str,
/// The offending name.
name: String,
},
/// A flow writes to a target that is not a declared dataset.
#[error("flow {flow} writes to undefined dataset {target}")]
DanglingFlow {
/// The offending flow.
flow: String,
/// The missing target.
target: String,
},
/// The in-graph dataflow contains a cycle.
#[error("pipeline dataflow graph is cyclic")]
Cyclic,
/// A backend was asked to do something it does not support (e.g. the
/// Spark backend asked to run an output mode SDP cannot express).
#[error("backend `{backend}` does not support: {what}")]
Unsupported {
/// Backend name.
backend: &'static str,
/// What was unsupported.
what: String,
},
/// The DSL text could not be parsed into a [`crate::ir::Pipeline`].
#[error("dsl parse error: {0}")]
Dsl(String),
/// The SQL text could not be parsed into a [`crate::ir::Pipeline`]
/// (see [`crate::authoring::sql`], feature `sql`).
#[error("sql parse error: {0}")]
Sql(String),
/// A backend runtime failure (connection, execution, …).
#[error("backend error: {0}")]
Backend(String),
}