Skip to main content

worldinterface_flowspec/
error.rs

1//! Compilation error types.
2
3use worldinterface_core::flowspec::validate::ValidationError;
4use worldinterface_core::id::NodeId;
5
6/// Errors that can occur during FlowSpec compilation.
7#[derive(Debug, thiserror::Error)]
8pub enum CompilationError {
9    /// The FlowSpec failed validation.
10    #[error("FlowSpec validation failed: {0}")]
11    ValidationFailed(#[from] ValidationError),
12
13    /// Failed to serialize a payload to JSON.
14    #[error("payload serialization failed: {0}")]
15    PayloadSerializationFailed(#[from] serde_json::Error),
16
17    /// Failed to construct an AQ TaskSpec.
18    #[error("TaskSpec construction failed for node {node_id:?}: {source}")]
19    TaskSpecFailed {
20        node_id: Option<NodeId>,
21        #[source]
22        source: actionqueue_core::task::task_spec::TaskSpecError,
23    },
24
25    /// The FlowSpec has no nodes (should be caught by validation, but defensive).
26    #[error("FlowSpec has no nodes")]
27    EmptyFlowSpec,
28}