Skip to main content

NodeError

Enum NodeError 

Source
#[non_exhaustive]
pub enum NodeError {
Show 27 variants Config(NodeConfigError), MissingEnv { name: &'static str, }, BadEnv { name: &'static str, value: String, reason: String, }, Connect { attempts: Vec<(String, String)>, }, Handshake(String), Registration(String), DaemonGone, Transport(TransportError), Wire(WireError), Data(DataError), Ipc(IpcError), TypeUrn(TypeUrnError), Shm(ShmError), Id(IdError), Scheduler(SchedulerError), UnknownOutput { output: DataId, }, UnknownInput { input: DataId, }, TypeMismatch { port: DataId, declared: String, requested: String, }, PayloadTooLarge { len: usize, max: usize, }, BlockingInAsync { method: &'static str, alternative: &'static str, }, Stopped, Orphaned { parent_pid: u32, }, Timeout { operation: &'static str, millis: u64, }, Backpressure { depth: usize, }, Runtime(String), Pattern(String), Testing(String),
}
Expand description

Everything that can go wrong in a node.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Config(NodeConfigError)

The ASTRS_NODE_CONFIG blob was missing, corrupt or unusable (§24.2).

§

MissingEnv

A required environment variable was unset.

Fields

§name: &'static str

The variable that was looked for.

§

BadEnv

An environment variable held something this build cannot parse.

Fields

§name: &'static str

The variable.

§value: String

What it held.

§reason: String

Why that is not usable.

§

Connect

No daemon endpoint could be dialled.

Carries every attempt, because “connection refused” on the Unix socket and “no route to host” on the TCP fallback are two different diagnoses and a node that reports only the last one sends its operator looking in the wrong place.

Fields

§attempts: Vec<(String, String)>

One (endpoint, reason) pair per attempt, in the order tried.

§

Handshake(String)

The daemon refused the greeting, or the greeting could not be completed (§7.2).

§

Registration(String)

The daemon refused the registration (§7.3 Register).

§

DaemonGone

The connection to the daemon ended.

§

Transport(TransportError)

A transport-level failure.

§

Wire(WireError)

A protocol-level failure.

§

Data(DataError)

A columnar payload could not be built, encoded or decoded.

§

Ipc(IpcError)

An Arrow IPC stream could not be encoded or decoded (§6.1).

§

TypeUrn(TypeUrnError)

A type URN was malformed, unknown, or did not match a port’s declared layout.

§

Shm(ShmError)

A shared-memory operation failed (§6.2).

§

Id(IdError)

An identifier failed its grammar.

§

Scheduler(SchedulerError)

An input queue could not be created or registered (§11.2).

§

UnknownOutput

The node has no such output.

Fields

§output: DataId

The name that was asked for.

§

UnknownInput

The node has no such input.

Fields

§input: DataId

The name that was asked for.

§

TypeMismatch

A typed handle was opened on a port whose declared URN says something else (§9.2, ASTRS_TYPE_CHECK=error).

Fields

§port: DataId

The port.

§declared: String

What the manifest says.

§requested: String

What the code asked for.

§

PayloadTooLarge

A payload exceeded the §6.1 cap or the negotiated frame limit.

Fields

§len: usize

The payload size.

§max: usize

The applicable ceiling.

§

BlockingInAsync

A blocking call was made from a single-threaded async context, where blocking would deadlock the only worker.

The fix is always the same: call the _async twin of whatever was called, or run the node’s loop on a multi-thread runtime.

Fields

§method: &'static str

The blocking method that was called.

§alternative: &'static str

The method to call instead.

§

Stopped

The node was asked to stop (§7.3 Stop).

Returned by operations attempted after the event stream fused. It is an expected ending, not a failure — see NodeError::is_shutdown.

§

Orphaned

The supervising process disappeared, so this node is an orphan (§4.2).

Fields

§parent_pid: u32

The process that went away.

§

Timeout

An operation ran out of time.

Fields

§operation: &'static str

What was being waited for.

§millis: u64

How long it was waited for.

§

Backpressure

The request channel to the daemon is full and the caller asked not to wait.

The channel is bounded on purpose: an unbounded one turns a wedged daemon into unbounded memory growth in every node at once.

Fields

§depth: usize

The channel’s capacity.

§

Runtime(String)

A tokio runtime could not be built for a node created outside one.

§

Pattern(String)

A pattern helper was used out of order (§9.4).

§

Testing(String)

The testing harness could not be driven as asked.

Implementations§

Source§

impl NodeError

Source

pub const fn is_shutdown(&self) -> bool

Whether this error means “shut down cleanly” rather than “something broke”.

§Examples
use astrs_node_api::NodeError;

assert!(NodeError::Stopped.is_shutdown());
assert!(NodeError::Orphaned { parent_pid: 1 }.is_shutdown());
assert!(!NodeError::DaemonGone.is_shutdown());
Source

pub const fn is_retryable(&self) -> bool

Whether retrying the same operation could plausibly succeed.

§Examples
use astrs_node_api::NodeError;

assert!(NodeError::Backpressure { depth: 64 }.is_retryable());
assert!(!NodeError::UnknownInput { input: "x".parse()? }.is_retryable());
Source

pub const fn is_usage_error(&self) -> bool

Whether this error is the node’s own fault — a call that can never succeed as written.

Source

pub const fn exit_code(&self) -> i32

The process exit status a main should use for this error.

A clean shutdown is 0; everything else is 1, which is what the daemon’s restart policy (§12) reads as a failure.

§Examples
use astrs_node_api::NodeError;

assert_eq!(NodeError::Stopped.exit_code(), 0);
assert_eq!(NodeError::DaemonGone.exit_code(), 1);
Source

pub const fn kind_name(&self) -> &'static str

A short, stable slug for metrics labels and structured logs.

Source

pub const fn stop_cause(&self) -> Option<StopCause>

The stop cause a node should report for this error, when it reports one.

Trait Implementations§

Source§

impl Debug for NodeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for NodeError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for NodeError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DataError> for NodeError

Source§

fn from(error: DataError) -> Self

Converts to this type from the input type.
Source§

impl From<IdError> for NodeError

Source§

fn from(error: IdError) -> Self

Converts to this type from the input type.
Source§

impl From<IpcError> for NodeError

Source§

fn from(error: IpcError) -> Self

Converts to this type from the input type.
Source§

impl From<NodeConfigError> for NodeError

Source§

fn from(error: NodeConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<NodeError> for ArrowSendError

Available on crate feature arrow-interop only.
Source§

fn from(source: NodeError) -> Self

Converts to this type from the input type.
Source§

impl From<SchedulerError> for NodeError

Source§

fn from(error: SchedulerError) -> Self

Converts to this type from the input type.
Source§

impl From<ShmError> for NodeError

Source§

fn from(error: ShmError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for NodeError

Source§

fn from(error: TransportError) -> Self

Converts to this type from the input type.
Source§

impl From<TypeUrnError> for NodeError

Source§

fn from(error: TypeUrnError) -> Self

Converts to this type from the input type.
Source§

impl From<WireError> for NodeError

Source§

fn from(error: WireError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeDebug for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more