Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 31 variants UnknownSymbol { symbol: Symbol, }, UnknownClass { class: Symbol, }, UnknownFunction { function: Symbol, }, MissingClass(ClassId), WrongClass { expected: ClassId, found: ClassId, }, WrongShape { expected: ShapeId, diagnostics: Vec<Diagnostic>, }, AmbiguousOverload { function: FunctionId, candidates: Vec<CaseId>, }, NoMatchingOverload { function: FunctionId, diagnostics: Vec<Diagnostic>, }, AmbiguousNumberDispatch { operator: Symbol, candidates: Vec<(Symbol, Symbol)>, }, NoPromotionPath { operator: Symbol, left_domain: Symbol, right_domain: Symbol, }, PromotionSearchLimitExceeded { from_domain: Symbol, target_domain: Symbol, max_depth: usize, max_states: usize, }, CapabilityDenied { capability: CapabilityName, }, TrustDenied { capability: CapabilityName, trust: TrustLevel, }, CodecError { codec: CodecId, message: String, }, DomainError { domain: Symbol, category: Symbol, message: String, }, DuplicateExport { kind: &'static str, symbol: Symbol, }, DuplicateLib { symbol: Symbol, }, CatalogConflict { table: Symbol, key: Symbol, }, CatalogReadOnly { table: Symbol, }, CatalogSchema { table: Symbol, message: String, }, MissingDependency { lib: Symbol, dependency: Symbol, }, DependencyVersionMismatch { lib: Symbol, dependency: Symbol, required: Version, loaded: Version, }, CyclicDependency { symbol: Symbol, }, LibHasDependents { lib: Symbol, dependents: Vec<Symbol>, }, UndeclaredExportRecord { kind: ExportKind, symbol: Symbol, }, TypeMismatch { expected: &'static str, found: &'static str, }, Eval(String), Lib(String), PoisonedLock(&'static str), RecursiveThunkForce, HostError(String),
}
Expand description

The kernel error type reported by every contract and library.

The kernel defines the shared error vocabulary; libraries raise these variants (and wrap their own messages in the string-carrying variants) rather than inventing parallel error types.

Variants§

§

UnknownSymbol

A symbol could not be resolved.

Fields

§symbol: Symbol

The unresolved symbol.

§

UnknownClass

A class name could not be resolved.

Fields

§class: Symbol

The unresolved class name.

§

UnknownFunction

A function name could not be resolved.

Fields

§function: Symbol

The unresolved function name.

§

MissingClass(ClassId)

No class is registered under the given id.

§

WrongClass

A value’s class did not match the expected class.

Fields

§expected: ClassId

The class that was required.

§found: ClassId

The class actually found.

§

WrongShape

A value did not match the expected shape.

Fields

§expected: ShapeId

The shape that was required.

§diagnostics: Vec<Diagnostic>

Diagnostics explaining the mismatch.

§

AmbiguousOverload

More than one overload matched a call.

Fields

§function: FunctionId

The function being dispatched.

§candidates: Vec<CaseId>

The competing candidate cases.

§

NoMatchingOverload

No overload matched a call.

Fields

§function: FunctionId

The function being dispatched.

§diagnostics: Vec<Diagnostic>

Diagnostics explaining why each case was rejected.

§

AmbiguousNumberDispatch

More than one numeric domain pairing matched an operator.

Fields

§operator: Symbol

The operator being dispatched.

§candidates: Vec<(Symbol, Symbol)>

The competing left/right domain pairings.

§

NoPromotionPath

No promotion path joined two number domains for an operator.

Fields

§operator: Symbol

The operator being dispatched.

§left_domain: Symbol

The left operand’s domain.

§right_domain: Symbol

The right operand’s domain.

§

PromotionSearchLimitExceeded

Promotion search exceeded its configured limits.

Fields

§from_domain: Symbol

The domain the search started from.

§target_domain: Symbol

The domain the search was targeting.

§max_depth: usize

The depth limit that was hit.

§max_states: usize

The state-count limit that was hit.

§

CapabilityDenied

A required capability was not granted.

Fields

§capability: CapabilityName

The denied capability.

§

TrustDenied

A capability is not allowed at the caller’s trust level.

Fields

§capability: CapabilityName

The requested capability.

§trust: TrustLevel

The caller’s trust level.

§

CodecError

A codec failed to read or write a form.

Fields

§codec: CodecId

The codec that failed.

§message: String

The failure message.

§

DomainError

A number (or other) domain reported a categorized failure.

Fields

§domain: Symbol

The domain that failed.

§category: Symbol

The error category within the domain.

§message: String

The failure message.

§

DuplicateExport

Two exports of the same kind claimed the same symbol.

Fields

§kind: &'static str

The export kind label.

§symbol: Symbol

The conflicting symbol.

§

DuplicateLib

Two libraries claimed the same name.

Fields

§symbol: Symbol

The conflicting library name.

§

CatalogConflict

A catalog write conflicted with an existing key.

Fields

§table: Symbol

The catalog table.

§key: Symbol

The conflicting key.

§

CatalogReadOnly

A write targeted a read-only catalog table.

Fields

§table: Symbol

The read-only table.

§

CatalogSchema

A catalog row violated its table schema.

Fields

§table: Symbol

The table whose schema was violated.

§message: String

The schema-violation message.

§

MissingDependency

A library declared a dependency that is not loaded.

Fields

§lib: Symbol

The depending library.

§dependency: Symbol

The missing dependency.

§

DependencyVersionMismatch

A dependency is present but older than required.

Fields

§lib: Symbol

The depending library.

§dependency: Symbol

The dependency name.

§required: Version

The minimum required version.

§loaded: Version

The version actually loaded.

§

CyclicDependency

A cycle was found among library dependencies.

Fields

§symbol: Symbol

A library on the cycle.

§

LibHasDependents

A library cannot be unloaded because loaded libraries depend on it.

Fields

§lib: Symbol

The library requested for unload.

§dependents: Vec<Symbol>

Loaded libraries that depend on it.

§

UndeclaredExportRecord

An export record was produced without a matching manifest declaration.

Fields

§kind: ExportKind

The export kind.

§symbol: Symbol

The undeclared symbol.

§

TypeMismatch

A value’s static type did not match what was expected.

Fields

§expected: &'static str

The expected type label.

§found: &'static str

The type label actually found.

§

Eval(String)

Evaluation failed; carries a free-form message.

§

Lib(String)

A library reported a free-form failure.

§

PoisonedLock(&'static str)

A lock was poisoned by a panic; carries the lock name.

§

RecursiveThunkForce

A thunk was forced while already being forced.

§

HostError(String)

The host environment reported a free-form failure.

Implementations§

Source§

impl Error

Source

pub fn domain_error( domain: Symbol, category: Symbol, message: impl Into<String>, ) -> Self

Builds a Error::DomainError from its parts.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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, __formatter: &mut Formatter<'_>) -> Result

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

impl Error for Error

1.30.0 · 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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.