Skip to main content

SomaError

Enum SomaError 

Source
#[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
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.
§

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.

Fields

§node_id: String

The node that failed.

§message: String

What went wrong.

§

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

§step: usize

The intermediate-report step at which the pruner intervened.

§reason: String

Which rule fired, in the pruner’s words.

§

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

§run_id: String

The run that stopped — the id to resume with.

§node_id: String

The node whose step suspended.

§turn: usize

The 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.

Fields

§expected: String

What the consumer’s schema demands.

§got: String

What actually arrived.

§

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 Debug for SomaError

Source§

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

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

impl Display for SomaError

Source§

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

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

impl Error for SomaError

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<Error> for SomaError

Source§

fn from(source: Error) -> 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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

The receiver as &dyn Any, ready for downcast_ref.
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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.