Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 15 variants TypeMismatch { expected: TypeId, found: TypeId, sites: Vec<ErrorSite>, }, InvalidId, Conflict { sites: Vec<ErrorSite>, }, Cycle { sites: Vec<ErrorSite>, }, SeedCycle { sites: Vec<ErrorSite>, }, MethodFailed { error: Error, sites: Vec<ErrorSite>, }, InvalidMethod { sites: Vec<ErrorSite>, }, MismatchedMethodCells { sites: Vec<ErrorSite>, }, InvalidMethodOutputs { sites: Vec<ErrorSite>, }, InvalidConditional { sites: Vec<ErrorSite>, }, InvalidOutput, InvalidCellKind { sites: Vec<ErrorSite>, }, InvalidFilter, InvalidRequirement, DependencyCycle { sites: Vec<ErrorSite>, },
}
Expand description

Errors returned by Sheet operations and propagation.

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

TypeMismatch

A value’s TypeId did not match the cell’s registered TypeId.

  • expected: the TypeId registered when the cell was created.
  • found: the TypeId of the value or declaration supplied by the caller.

Fields

§expected: TypeId

The TypeId registered when the cell was created.

§found: TypeId

The TypeId of the value or declaration supplied by the caller.

§sites: Vec<ErrorSite>

The method this mismatch was detected in, if known. Empty when unknown.

§

InvalidId

A CellId or RelationshipId was not found in the sheet.

§

Conflict

No valid method assignment exists, or staged prerequisite provenance conflicts with the final selected plan.

Fields

§sites: Vec<ErrorSite>

Relationships, methods, and cells involved in an impossible assignment or an incompatible staged prerequisite reuse.

§

Cycle

The selected methods form a cycle.

Fields

§sites: Vec<ErrorSite>

The cycle’s members in loop-traversal order, alternating Relationship and Cell entries for the length of the loop. Either kind may be sites[0]: the loop is reported starting at the first node revisited during recovery, which is not necessarily a Relationship.

§

SeedCycle

The seed dependency graph contains a non-self cycle.

Fields

§sites: Vec<ErrorSite>

The cycle’s members in deterministic traversal order, starting at the first revisited Cell and alternating through the sibling Relationships that force the cycle. The closing relationship appears last; the starting cell is not repeated at the end.

§

MethodFailed

A method’s function returned an error during execution.

Fields

§error: Error

The underlying error the method’s function (or a requirement’s/conditional’s expression function) returned.

§sites: Vec<ErrorSite>

The method this failure originated from, if known. Empty when unknown.

§

InvalidMethod

A method is structurally invalid (e.g. the outputs list is empty, a relationship’s methods reference different sets of cells, or two methods in a relationship share an identical output set). A method with no inputs is not an error: it defines a fixed point (a constant) rather than a derivation.

Fields

§sites: Vec<ErrorSite>

The method (by index within the Vec passed to add_relationship) that’s invalid, if known. Empty when methods itself is empty.

§

MismatchedMethodCells

Two methods in the same relationship have inputs ∪ outputs sets that don’t match. Every method in a relationship must reference exactly the same set of cells.

Fields

§sites: Vec<ErrorSite>

sites[0] is the first method (by index within the Vec passed to add_relationship) whose cell set diverges from method 0’s; sites[1] is always MethodIndex(0), the baseline every other method’s cell set is compared against; further entries are the cells in the symmetric difference of the two methods’ cell sets.

§

InvalidMethodOutputs

A method’s own outputs list names a cell more than once, or two methods in the same relationship have identical or nested outputs sets. Overlapping output sets are allowed when neither set nests the other.

Fields

§sites: Vec<ErrorSite>

sites[0] is the method (by index within the Vec passed to add_relationship) whose output set collided. For a method’s own outputs repeating a cell, further entries are the repeated cell(s). For two methods with identical or nested output sets, sites[1] is the earlier method’s index and further entries are the duplicate or nested subset cell(s).

§

InvalidConditional

A conditional is structurally invalid: the cell was not found, a referenced relationship was not found, a relationship appears in more than one conditional branch, a branch key’s type does not match the cell’s registered type, or a branch has no keys.

Fields

§sites: Vec<ErrorSite>

Empty for the expression-output type-mismatch case; the match-cell type-mismatch case names the cell (sites = [Cell(match_cell)]). The duplicate-relationship case names the offending relationship. Empty for the missing-relationship and empty-branch-keys cases.

§

InvalidOutput

An add_out call is structurally invalid: the writer method does not have exactly one output cell.

§

InvalidCellKind

A relationship or conditional attempted to claim a Source-kind cell as a method’s output, write() targeted an Out-kind cell, or add_out targeted a cell that is already Source/Out kind or already claimed as another method’s output.

Fields

§sites: Vec<ErrorSite>

sites[0] is the method (by index within the Vec passed to add_relationship) whose output cell has the wrong kind, if the error originated there; sites[1] is that offending cell. Empty when the error did not originate from add_relationship.

§

InvalidFilter

An add_filter call is structurally invalid: the cell already has a filter, the filter’s own value type does not match the cell’s registered type, or the filter’s own argument list names cell itself. (An unknown cell or an argument-cell type mismatch use the shared InvalidId/TypeMismatch variants instead — add_filter has no cell-kind restriction, so it never returns InvalidCellKind.)

§

InvalidRequirement

An add_requirement call has an invalid input signature, or (on a Cell/Source kind cell) evaluating the requirement against current values returns Ok(false).

§

DependencyCycle

A filter’s argument, or a conditional’s match subject, depends on a cell that filter or conditional governs, in the sheet’s static dependency graph: every method’s input → output edges (a self-referencing input adds none), each filter’s argument → filtered guard edges, and each conditional’s match cell → output guard edges for every method output of its branch and default relationships. Returned by Sheet::validate and by Sheet::propagate, which validates before mutating propagation state.

Fields

§sites: Vec<ErrorSite>

The cycle in dependency order, starting at the governed cell t and ending at the guard cell g whose guard edge g → t closes it. Cell entries are separated by the Relationship each method hop runs through. Two consecutive Cell entries are a guard hop.

Implementations§

Source§

impl Error

Source

pub fn sites(&self) -> &[ErrorSite]

The source components this error implicates, primary first.

sites[0] is the primary culprit; further entries are ordered related context (for a cycle, the remaining members in loop order). Empty for variants that never track a site, or when none applies to this occurrence.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

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

Returns the underlying anyhow::Error source for MethodFailed.

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

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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