ReferenceRust referencesigil-wasm
sigil-wasm · error
Source declarations, signatures and documentation for error.
Source: sigil/node/sigil-wasm/src/error.rs. SHA-256: 4515a0264e09522666607965e56b86d182a62a0552c069312a1b5053372f56ab.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
error::WasmError
Top-level error from the Sigil WASM runtime.
#[derive(Debug, Error)]
pub enum WasmError {
/// Failed to construct or configure the wasmtime engine.
#[error("wasmtime engine error: {0}")]
Engine(String),
/// Failed to compile the supplied bytecode.
#[error("wasm module compilation failed: {0}")]
Compile(String),
/// Failed to instantiate the module against the linker.
#[error("wasm module instantiation failed: {0}")]
Instantiate(String),
/// The contract did not export the required entrypoint or it had
/// the wrong signature.
#[error("missing or invalid entrypoint: {0}")]
BadEntrypoint(String),
/// The contract trapped during execution. State changes from this
/// invocation MUST be discarded.
#[error("contract trapped during execution: {0}")]
Trap(String),
/// The contract exhausted its fuel/gas budget.
#[error("out of fuel (gas exhausted)")]
OutOfFuel,
/// Memory access out of bounds (e.g. host pointer/length didn't
/// fit inside the guest memory).
#[error("memory access out of bounds: {0}")]
MemoryOutOfBounds(String),
/// The host function call returned a typed error to the guest.
/// Distinct from `Trap` — the guest may have caught and continued.
#[error("host function error: {0}")]
Host(#[from] HostError),
/// Generic catch-all for backend-specific failures.
#[error("backend error: {0}")]
Backend(String),
}Source line: 7.
error::HostError
Errors raised by host backend functions. These are separate from
WasmError::Trap because a guest may catch them and continue.
#[derive(Debug, Clone, Error, PartialEq, Eq)]
pub enum HostError {
/// The contract attempted to use a host function it was not granted
/// in `ContractRecord.allowed_host_functions`.
#[error("host function `{0}` not in contract allowlist")]
HostFunctionNotAllowed(String),
/// The host function was called with malformed arguments (bad
/// pointer, bad length, malformed UTF-8, etc.).
#[error("invalid host fn argument: {0}")]
InvalidArgument(String),
/// The requested key is not present in contract state.
#[error("key not found")]
KeyNotFound,
/// The host backend rejected the call (e.g. storage error,
/// compute-marketplace constraint violation).
#[error("host backend rejected call: {0}")]
Backend(String),
/// The contract is not authorised to perform the requested
/// privileged action (e.g. dispatch_compute without a mandate, or
/// upgrade outside policy).
#[error("permission denied: {0}")]
PermissionDenied(String),
/// The host backend hit an internal limit (event count, message
/// queue, etc.).
#[error("host limit exceeded: {0}")]
LimitExceeded(String),
}Source line: 44.