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
DeserializationFailed
A previously serialized (cached) compiled component could not be deserialized.
Causes: cache corruption, engine version mismatch, config mismatch.
InstantiationFailed
Component instantiation failed.
Causes: unresolved imports, resource limit exceeded during instantiation, initialization trap.
Fields
component_id: ComponentIdThe component that failed to instantiate.
UnresolvedImport
A component import could not be resolved during linking.
Fields
component_id: ComponentIdThe component with 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: ComponentIdThe component that trapped.
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: ComponentIdThe component that ran out of fuel.
MemoryLimitExceeded
The component exceeded its memory limit.
Fields
component_id: ComponentIdThe component that exceeded the limit.
TypeMismatch
A type mismatch occurred during invocation.
The arguments or return values did not match the expected Component Model types.
Fields
component_id: ComponentIdThe component with the type mismatch.
ExportNotFound
The requested export function was not found on the component.
Fields
component_id: ComponentIdThe component missing the export.
Internal
An internal engine error that should not occur under normal operation.
WasiConfigError
WASI configuration failed.
Fields
component_id: ComponentIdThe component with the WASI config problem.
InvocationTimeout
Timeout waiting for a component invocation to complete.
Implementations§
Source§impl EngineError
impl EngineError
Sourcepub fn is_fatal(&self) -> bool
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.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is transient and the operation
might succeed on retry.
§WARM PATH
Trait Implementations§
Source§impl Debug for EngineError
impl Debug for EngineError
Source§impl Display for EngineError
impl Display for EngineError
Source§impl Error for EngineError
impl Error for EngineError
1.30.0 · 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()
Source§impl From<EngineError> for TorvynError
impl From<EngineError> for TorvynError
Source§fn from(e: EngineError) -> Self
fn from(e: EngineError) -> Self
Auto Trait Implementations§
impl Freeze for EngineError
impl RefUnwindSafe for EngineError
impl Send for EngineError
impl Sync for EngineError
impl Unpin for EngineError
impl UnsafeUnpin for EngineError
impl UnwindSafe for EngineError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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