mod into_node;
mod r#trait;
pub use into_node::{
IntoNode, NodeFnCommand, NodeFnCommandWithConfig, NodeFnCommandWithConfigAndRuntime,
NodeFnCommandWithRuntime, NodeFnUpdate, NodeFnUpdateWithConfig,
NodeFnUpdateWithConfigAndRuntime, NodeFnUpdateWithRuntime,
};
pub use r#trait::Node;
#[derive(Debug)]
pub struct NodeError<S: crate::State> {
pub node: String,
pub error: crate::JunctureError,
pub state: S,
pub attempt: u32,
}
impl<S: crate::State> std::fmt::Display for NodeError<S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"Node '{}' failed on attempt {}: {}",
self.node, self.attempt, self.error
)
}
}
impl<S: crate::State> std::error::Error for NodeError<S> {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
self.error.source()
}
}