Skip to main content

EngineError

Enum EngineError 

Source
pub enum EngineError {
    CompilationFailed {
        reason: String,
        source_hint: Option<String>,
    },
    DeserializationFailed {
        reason: String,
    },
    InstantiationFailed {
        component_id: ComponentId,
        reason: String,
    },
    UnresolvedImport {
        component_id: ComponentId,
        import_name: String,
    },
    Trap {
        component_id: ComponentId,
        trap_code: String,
    },
    FuelExhausted {
        component_id: ComponentId,
        fuel_limit: u64,
    },
    MemoryLimitExceeded {
        component_id: ComponentId,
        attempted_bytes: usize,
        limit_bytes: usize,
    },
    TypeMismatch {
        component_id: ComponentId,
        function_name: String,
        detail: String,
    },
    ExportNotFound {
        component_id: ComponentId,
        function_name: String,
    },
    Internal {
        reason: String,
    },
    WasiConfigError {
        component_id: ComponentId,
        reason: String,
    },
    InvocationTimeout {
        component_id: ComponentId,
        function_name: String,
        timeout_ms: u64,
    },
}
Expand description

Errors originating from the Wasm engine layer.

This is the primary error type returned by WasmEngine and ComponentInvoker operations.

All variants include actionable error messages that tell the user what went wrong, where, and how to fix it.

§Error Code Range

E0800–E0899

§Examples

use torvyn_engine::EngineError;

let err = EngineError::CompilationFailed {
    reason: "invalid magic number".into(),
    source_hint: Some("my-component.wasm".into()),
};
assert!(format!("{}", err).contains("E0800"));

Variants§

§

CompilationFailed

The Wasm component binary could not be compiled.

Causes: invalid binary format, unsupported Wasm features, compiler internal error.

Fields

§reason: String

The reason compilation failed.

§source_hint: Option<String>

Optional hint about the source file.

§

DeserializationFailed

A previously serialized (cached) compiled component could not be deserialized.

Causes: cache corruption, engine version mismatch, config mismatch.

Fields

§reason: String

The reason deserialization failed.

§

InstantiationFailed

Component instantiation failed.

Causes: unresolved imports, resource limit exceeded during instantiation, initialization trap.

Fields

§component_id: ComponentId

The component that failed to instantiate.

§reason: String

The reason instantiation failed.

§

UnresolvedImport

A component import could not be resolved during linking.

Fields

§component_id: ComponentId

The component with the unresolved import.

§import_name: String

The name of the unresolved import.

§

Trap

The component trapped during execution.

A trap is an unrecoverable error within the Wasm execution (e.g., unreachable instruction, division by zero, out-of-bounds memory access).

Fields

§component_id: ComponentId

The component that trapped.

§trap_code: String

Description of the trap.

§

FuelExhausted

The component exhausted its fuel budget.

The component consumed more CPU than its allocated fuel allows. This is a safety mechanism to prevent infinite loops and CPU-intensive components from starving others.

Fields

§component_id: ComponentId

The component that ran out of fuel.

§fuel_limit: u64

The fuel budget that was exceeded.

§

MemoryLimitExceeded

The component exceeded its memory limit.

Fields

§component_id: ComponentId

The component that exceeded the limit.

§attempted_bytes: usize

How many bytes the component tried to use.

§limit_bytes: usize

The configured limit.

§

TypeMismatch

A type mismatch occurred during invocation.

The arguments or return values did not match the expected Component Model types.

Fields

§component_id: ComponentId

The component with the type mismatch.

§function_name: String

The function being invoked.

§detail: String

Details about the mismatch.

§

ExportNotFound

The requested export function was not found on the component.

Fields

§component_id: ComponentId

The component missing the export.

§function_name: String

The function that was not found.

§

Internal

An internal engine error that should not occur under normal operation.

Fields

§reason: String

Description of the internal error.

§

WasiConfigError

WASI configuration failed.

Fields

§component_id: ComponentId

The component with the WASI config problem.

§reason: String

The reason WASI config failed.

§

InvocationTimeout

Timeout waiting for a component invocation to complete.

Fields

§component_id: ComponentId

The component that timed out.

§function_name: String

The function that timed out.

§timeout_ms: u64

How long we waited (ms).

Implementations§

Source§

impl EngineError

Source

pub fn is_fatal(&self) -> bool

Returns true if this error represents a fatal, unrecoverable condition for the component (trap, fuel exhaustion).

§WARM PATH — called per error to determine component fate.
Source

pub fn is_retryable(&self) -> bool

Returns true if this error is transient and the operation might succeed on retry.

§WARM PATH
Source

pub fn code(&self) -> &'static str

Returns the error code as a static string for metrics labels.

§WARM PATH

Trait Implementations§

Source§

impl Debug for EngineError

Source§

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

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

impl Display for EngineError

Source§

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

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

impl Error for EngineError

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

impl From<EngineError> for TorvynError

Source§

fn from(e: EngineError) -> 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.