1use core::fmt;
5
6#[derive(Debug, PartialEq, Eq)]
8pub enum TaskError {
9 CycleDetected,
11 CapacityExceeded,
13 TaskExecutionFailed(&'static str),
15 Timeout,
17 InvalidState,
19 Panic,
21 PersistenceError,
23}
24
25impl fmt::Display for TaskError {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 match self {
28 Self::CycleDetected => write!(f, "Cycle detected in DAG"),
29 Self::CapacityExceeded => write!(f, "Graph capacity exceeded"),
30 Self::TaskExecutionFailed(reason) => write!(f, "Task execution failed: {}", reason),
31 Self::Timeout => write!(f, "Task timed out"),
32 Self::InvalidState => write!(f, "Invalid internal state"),
33 Self::Panic => write!(f, "Task panicked"),
34 Self::PersistenceError => write!(f, "Persistence error"),
35 }
36 }
37}
38
39#[cfg(feature = "std")]
40impl std::error::Error for TaskError {}
41
42pub type Result<T> = core::result::Result<T, TaskError>;