net_sdk/groups/error.rs
1//! Error surface for the `groups` module.
2//!
3//! Wraps the core `GroupError` and adds SDK-level variants
4//! (`NotReady`, `FactoryNotFound`) that the wrappers surface
5//! before touching the core. TS / Python / Go bindings dispatch
6//! on these via the same `daemon: group: <kind>[: detail]` prefix
7//! pattern used for migration errors.
8
9use thiserror::Error;
10
11use ::net::adapter::net::compute::GroupError as CoreGroupError;
12
13use crate::compute::DaemonError;
14
15/// Errors returned by the SDK's group wrappers.
16#[derive(Debug, Error)]
17pub enum GroupError {
18 /// The caller's `DaemonRuntime` has not yet reached `Ready`.
19 /// Start the runtime before constructing any group.
20 #[error("daemon runtime is not ready — call DaemonRuntime::start() first")]
21 NotReady,
22
23 /// The caller referenced a kind that was never registered
24 /// via `DaemonRuntime::register_factory`. Register the kind
25 /// before spawning a group of that kind.
26 #[error("no factory registered for kind '{0}'")]
27 FactoryNotFound(String),
28
29 /// Pass-through for errors surfaced by the core group layer
30 /// (`NoHealthyMember`, `PlacementFailed`, `RegistryFailed`,
31 /// `InvalidConfig`).
32 #[error(transparent)]
33 Core(#[from] CoreGroupError),
34
35 /// Pass-through for daemon-level errors surfaced during
36 /// member spawn (registry collision, host construction).
37 #[error("daemon error: {0}")]
38 Daemon(#[from] DaemonError),
39}