crates/knut-pipelines/src/error.rs
//! Error type for the pipelines viewer.
use thiserror::Error;
/// Crate-wide result alias.
pub type Result<T> = std::result::Result<T, PipelineError>;
/// Everything that can go wrong fetching, modelling or rendering a Spark
/// Declarative Pipelines dataflow graph and its run events.
#[derive(Debug, Error)]
pub enum PipelineError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
/// A flow targets a dataset that was never defined in the graph.
#[error("flow '{flow}' targets unknown dataset '{target}'")]
DanglingFlow { flow: String, target: String },
/// Two datasets (or two flows) share a name within one graph.
#[error("duplicate {kind} name '{name}' in dataflow graph")]
DuplicateName { kind: &'static str, name: String },
/// The transport/connection layer failed. Carries a string so the default
/// build (no gRPC deps) can still name connection errors symbolically.
#[error("Spark Connect transport error: {0}")]
Transport(String),
/// The server replied but with an unexpected/unsupported message shape.
#[error("unexpected Spark Connect response: {0}")]
Protocol(String),
#[error("{0}")]
Other(String),
}