Skip to main content

a3s_flow/workflow_dsl/
error.rs

1use thiserror::Error;
2
3/// Failure returned while parsing, validating, planning, or encoding workflow DSL.
4#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum WorkflowDslError {
7    /// The source exceeds the bounded parser input size.
8    #[error("workflow DSL document is {actual_bytes} bytes; maximum is {maximum_bytes} bytes")]
9    DocumentTooLarge {
10        /// Actual UTF-8 byte length of the source.
11        actual_bytes: usize,
12        /// Maximum accepted UTF-8 byte length.
13        maximum_bytes: usize,
14    },
15
16    /// YAML syntax or data conversion is invalid.
17    #[error("workflow DSL YAML is invalid: {message}")]
18    InvalidYaml {
19        /// Parser or conversion error description.
20        message: String,
21    },
22
23    /// JSON syntax or data conversion is invalid.
24    #[error("workflow DSL JSON is invalid: {message}")]
25    InvalidJson {
26        /// Parser or conversion error description.
27        message: String,
28    },
29
30    /// Document-level metadata or compatibility is invalid.
31    #[error("workflow DSL document is invalid: {message}")]
32    InvalidDocument {
33        /// Validation error description.
34        message: String,
35    },
36
37    /// The DAG cannot produce a valid deterministic execution plan.
38    #[error("workflow DAG is invalid: {message}")]
39    InvalidGraph {
40        /// Structural validation error description.
41        message: String,
42    },
43
44    /// A validated document or graph could not be serialized.
45    #[error("workflow DSL serialization failed: {message}")]
46    Serialization {
47        /// Serializer error description.
48        message: String,
49    },
50}