eval_magic/pipeline/error.rs
1//! Shared error type for the pipeline stages.
2//!
3//! The stages orchestrate filesystem IO, JSON (de)serialization, and schema
4//! validation, so a stage failure can originate in any of those. `PipelineError`
5//! unifies them behind one `thiserror` enum (the library-side convention; the CLI
6//! boundary maps it to `anyhow`).
7
8/// A recoverable failure while running a pipeline stage.
9#[derive(Debug, thiserror::Error)]
10pub enum PipelineError {
11 /// A stage-specific failure with a ready-to-display message.
12 #[error("{0}")]
13 Message(String),
14 /// Filesystem IO failure.
15 #[error(transparent)]
16 Io(#[from] std::io::Error),
17 /// JSON parse/serialize failure.
18 #[error(transparent)]
19 Json(#[from] serde_json::Error),
20 /// A produced artifact failed schema validation before write.
21 #[error(transparent)]
22 Validation(#[from] crate::validation::ValidationError),
23}