#[non_exhaustive]pub enum SomaError {
Show 13 variants
RequiresLabels,
Cache(String),
Compilation(String),
Execution {
node_id: String,
message: String,
},
Pruned {
step: usize,
reason: String,
},
Suspended {
run_id: String,
node_id: String,
turn: usize,
reason: Box<SuspendReason>,
},
SchemaMismatch {
expected: String,
got: String,
},
NodeNotFound(String),
CycleDetected,
Serialization(String),
DataStore(String),
Io(Error),
Other(String),
}Expand description
The one error type the whole workspace returns.
A single enum rather than per-crate errors so ? composes across every
crate boundary without conversion layers. #[non_exhaustive] on purpose:
most callers act on one or two variants — Suspended,
Pruned — and pass the rest along, so adding a variant
should not break them.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RequiresLabels
fit was called without y on a filter that learns from labels.
Cache(String)
The cache store failed to read, write, or resolve an entry.
Compilation(String)
The compiler rejected the graph: a schema mismatch across an edge, a loop or branch it cannot claim, a reference to nothing.
Execution
A node failed while running. The workhorse variant: filter panics
(caught in run_node), step errors, and effect failures a step chose
not to absorb all surface here, named after the node they came from.
Pruned
A pruner stopped the trial early. Closer to control flow than to a fault: the study runner records the trial as pruned, not failed, and the Python bindings surface it as its own exception type.
Fields
Suspended
The run stopped at node_id, waiting for something outside it.
Not a failure: the work so far is journaled and the run continues
where it left off once the answer is supplied. It travels as an error
so that ? unwinds the whole plan — a suspended run must not have
its later nodes execute — while callers that care can match on it.
reason stays typed. It used to be
serde_json::to_string(&reason).unwrap_or("unknown") — the shape a
caller needs in order to answer, flattened into a string that
nothing ever parsed back, which is why resuming was unreachable
from anywhere but Rust.
Fields
turn: usizeThe step’s turn at the moment it suspended; resume replays the journal up to here and re-polls with the answer.
reason: Box<SuspendReason>Boxed: SomaError is returned from nearly every function in
the workspace, and this is the only variant with a payload
worth more than a pointer.
SchemaMismatch
A value did not have the shape its consumer declared — raised both by the compiler checking edges and at runtime when data arrives.
NodeNotFound(String)
Something referenced a node id — an edge endpoint, a Goto target, a
spawn spec — that the graph does not contain.
CycleDetected
The graph’s data edges form a cycle, so no execution order exists. Iteration is expressed as a declared loop the compiler claims, never by wiring a data edge back around.
Serialization(String)
Encoding or decoding failed — canonical CBOR for identities and journal keys, JSON for values, states, and the wire.
DataStore(String)
A crate::store::DataStore backend failed to put, get, or move data.
Io(Error)
An underlying filesystem error, converted via ?.
Other(String)
An error that fits no other variant — mostly host code and bindings.
Trait Implementations§
Source§impl Error for SomaError
impl Error for SomaError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()