1use std::error;
2use std::fmt;
3
4#[derive(Debug)]
5pub enum Error {
6 CloseNodeError(String, &'static str),
7 EmptyListError,
9 IteratorDropped,
10 NoAvailableNodeError,
11 ResolveGraphError(&'static str),
12}
13
14impl fmt::Display for Error {
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 match self {
17 Self::CloseNodeError(name, reason) => {
18 write!(f, "Failed to close node {}: {}", name, reason)
19 }
20 Self::EmptyListError => write!(f, "The dependency list is empty"),
21 Self::IteratorDropped => write!(
22 f,
23 "The iterator attached to the coordination thread dropped"
24 ),
25 Self::NoAvailableNodeError => write!(f, "No node are currently available"),
26 Self::ResolveGraphError(reason) => write!(f, "Failed to resolve the graph: {}", reason), }
28 }
29}
30
31impl error::Error for Error {}