1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum FlowError {
5 #[error("YAML parse error at {0}: {1}")]
6 Yaml(String, String),
7 #[error("Schema validation failed:\n{0}")]
8 Schema(String),
9 #[error(
10 "Node '{0}' must contain exactly one component key like 'qa.process' plus optional 'routing'"
11 )]
12 NodeComponentShape(String),
13 #[error("Invalid component key '{0}' in node '{1}' (must match ^[A-Za-z][\\w.-]*\\.[\\w.-]+$)")]
14 BadComponentKey(String, String),
15 #[error("Missing node '{0}' referenced in routing from '{1}'")]
16 MissingNode(String, String),
17 #[error("Internal error: {0}")]
18 Internal(String),
19}
20
21pub type Result<T> = std::result::Result<T, FlowError>;