ag_session/execution_graph/
error.rs1#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
5pub enum GraphContractError {
6 #[error("graph field `{0}` must not be blank")]
8 EmptyField(&'static str),
9 #[error("graph must contain at least one node")]
11 EmptyGraph,
12 #[error("graph expansion must append at least one node")]
14 EmptyExpansion,
15 #[error("graph revision counter is exhausted")]
17 RevisionExhausted,
18 #[error("duplicate graph {kind}: {id}")]
20 Duplicate {
21 kind: &'static str,
23 id: String,
25 },
26 #[error("unknown graph node: {0}")]
28 UnknownNode(String),
29 #[error("unknown output `{output}` of graph node `{node}`")]
31 UnknownOutput {
32 node: String,
34 output: String,
36 },
37 #[error("graph dependencies contain a cycle")]
39 Cycle,
40 #[error("input `{0}` requires a dependency gate for its producing output")]
42 UngatedInput(String),
43 #[error("invalid graph execution profile: {0}")]
45 InvalidProfile(&'static str),
46 #[error("graph node environment belongs to a different session")]
48 ForeignEnv,
49 #[error("graph nodes cannot run in task worktrees yet")]
51 UnsupportedEnv,
52 #[error("graph result does not match {0}")]
54 ResultMismatch(&'static str),
55 #[error("graph result has not satisfied the input gate")]
57 UnsatisfiedGate,
58}
59
60impl GraphContractError {
61 pub(super) fn require(value: &str, field: &'static str) -> Result<(), Self> {
63 if value.trim().is_empty() {
64 return Err(Self::EmptyField(field));
65 }
66
67 Ok(())
68 }
69}