hydro2_operator/
errors.rs

1// ---------------- [ File: src/errors.rs ]
2#![allow(unused)]
3crate::ix!();
4
5error_tree!{
6
7    // Represents all possible errors that might arise while
8    // constructing or executing the network.
9    #[derive(Clone,PartialEq)]
10    pub enum NetworkError {
11        DowncastError(unsafe_erased::DowncastError),
12        InvalidPinAssignment,
13
14        /// we use this one to help during hydro2-network-wire-derive
15        PortTryFromNull,
16
17        TrySendError(TrySendError<usize>),
18
19        Timeout {
20            message: String,
21        },
22        /// A configuration was invalid, e.g., referencing
23        /// missing nodes, edges, or incompatible buffer types.
24        InvalidConfiguration {
25            // Additional details about the invalid configuration.
26            details: String,
27        },
28
29        /// Some resource was exhausted, such as memory, file
30        /// handles, or concurrency permits.
31        ResourceExhaustion {
32            // A string describing which resource was exhausted.
33            resource: String,
34        },
35
36        /// An operator encountered a failure during execution.
37        OperatorFailure {
38            // Identifies which operator failed and possibly why.
39            operator_name: String,
40            // Additional details about the failure.
41            reason: OperatorFailureReason,
42        },
43        NodeTaskPanic,
44        FailedToEnqueueInitialZeroDegreeNode,
45        AsyncSchedulerConfigBuilderFailure,
46        ThreadPanicked,
47        PoisonedLock,
48        OutOfBoundsEdge {
49            node_index: usize,
50            node_count: usize,
51        },
52        TaskItemBuildFailure {
53            node_index: usize,
54        },
55        InvalidNode {
56            node_idx: usize,
57        },
58        OperatorFailed {
59            reason: String,
60        }
61    }
62}
63
64#[derive(Debug,Clone,PartialEq,Eq,Hash)]
65pub enum OperatorFailureReason {
66    Unknown,
67}
68
69/// A convenient result alias for network operations.
70pub type NetResult<T> = Result<T, NetworkError>;