Skip to main content

jellyflow_core/ops/apply/
error.rs

1use crate::core::{
2    BindingId, EdgeId, GraphId, GraphValidationError, GroupId, NodeId, PortId, StickyNoteId,
3    SymbolId,
4};
5
6#[derive(Debug, thiserror::Error)]
7pub enum ApplyError {
8    #[error("node already exists: {id:?}")]
9    NodeAlreadyExists { id: NodeId },
10    #[error("missing node: {id:?}")]
11    MissingNode { id: NodeId },
12    #[error("port already exists: {id:?}")]
13    PortAlreadyExists { id: PortId },
14    #[error("missing port: {id:?}")]
15    MissingPort { id: PortId },
16    #[error("edge already exists: {id:?}")]
17    EdgeAlreadyExists { id: EdgeId },
18    #[error("missing edge: {id:?}")]
19    MissingEdge { id: EdgeId },
20    #[error("symbol already exists: {id:?}")]
21    SymbolAlreadyExists { id: SymbolId },
22    #[error("missing symbol: {id:?}")]
23    MissingSymbol { id: SymbolId },
24    #[error("group already exists: {id:?}")]
25    GroupAlreadyExists { id: GroupId },
26    #[error("missing group: {id:?}")]
27    MissingGroup { id: GroupId },
28    #[error("node parent references missing group: node={node:?} group={group:?}")]
29    NodeParentMissingGroup { node: NodeId, group: GroupId },
30    #[error("sticky note already exists: {id:?}")]
31    StickyNoteAlreadyExists { id: StickyNoteId },
32    #[error("missing sticky note: {id:?}")]
33    MissingStickyNote { id: StickyNoteId },
34    #[error("binding already exists: {id:?}")]
35    BindingAlreadyExists { id: BindingId },
36    #[error("missing binding: {id:?}")]
37    MissingBinding { id: BindingId },
38    #[error("node ports list contains unknown port: node={node:?} port={port:?}")]
39    NodePortsUnknownPort { node: NodeId, port: PortId },
40    #[error("edge references missing port: edge={edge:?} port={port:?}")]
41    EdgeMissingPort { edge: EdgeId, port: PortId },
42    #[error("import already exists: {id}")]
43    ImportAlreadyExists { id: GraphId },
44    #[error("missing import: {id}")]
45    MissingImport { id: GraphId },
46    #[error("remove node op did not match current node: {id:?}")]
47    RemoveNodeMismatch { id: NodeId },
48    #[error("remove port op did not match current port: {id:?}")]
49    RemovePortMismatch { id: PortId },
50    #[error("remove edge op did not match current edge: {id:?}")]
51    RemoveEdgeMismatch { id: EdgeId },
52    #[error("remove symbol op did not match current symbol: {id:?}")]
53    RemoveSymbolMismatch { id: SymbolId },
54    #[error("remove group op did not match current group: {id:?}")]
55    RemoveGroupMismatch { id: GroupId },
56    #[error(
57        "remove group op expected node parent mismatch: group={group:?} node={node:?} expected={expected:?}"
58    )]
59    RemoveGroupDetachedMismatch {
60        group: GroupId,
61        node: NodeId,
62        expected: Option<GroupId>,
63    },
64    #[error("remove sticky note op did not match current note: {id:?}")]
65    RemoveStickyNoteMismatch { id: StickyNoteId },
66    #[error("remove binding op did not match current binding: {id:?}")]
67    RemoveBindingMismatch { id: BindingId },
68    #[error("transaction result violates graph invariants: {errors:?}")]
69    InvalidTransactionResult { errors: Vec<GraphValidationError> },
70}