Skip to main content

Module error

Module error 

Source
Expand description

NodeError — every way a node can fail, named.

One error type for the whole surface, because a node author writes -> Result<(), NodeError> on main exactly once and never wants to think about it again (blueprint §9.1). The variants are grouped by who is at fault, which is what a caller actually branches on:

GroupVariantsTypical response
EnvironmentNodeError::Config, NodeError::MissingEnv, NodeError::BadEnvThe node was launched wrong; exit non-zero
ConnectionNodeError::Connect, NodeError::Transport, NodeError::Handshake, NodeError::DaemonGoneThe daemon is unreachable; exit and let supervision restart
LifecycleNodeError::Stopped, NodeError::OrphanedWind down cleanly; these are expected endings
UsageNodeError::UnknownOutput, NodeError::UnknownInput, NodeError::TypeMismatch, NodeError::BlockingInAsyncA bug in the node; fix the call
PayloadNodeError::Data, NodeError::PayloadTooLarge, NodeError::ShmBad or oversized data

§Examples

use astrs_node_api::NodeError;

let error = NodeError::Stopped;
assert!(error.is_shutdown());
assert!(!error.is_retryable());
assert_eq!(error.exit_code(), 0, "a requested stop is a clean exit");

Enums§

NodeError
Everything that can go wrong in a node.

Type Aliases§

Result
The node API’s result alias.