swactor/crates/wasm-actor/src/error.rs
Developer 60ee2d1a2c feat: wasm actor crate — run WebAssembly guests inside swactor actors
Adds `crates/wasm-actor/` (swactor-wasm-actor), which embeds wasmtime-sandboxed
Wasm instances inside regular swactor actors. Messages flow as raw bytes through
the guest ↔ host contract (alloc/handle exports, swactor.send import). The host
drains an outbox after each handle call and routes messages via ctx.send().

Includes 3 no_std guest modules (echo, double, silent) and 7 integration tests
covering roundtrip delivery, binary fidelity, multi-send, error cases, engine
sharing, and native↔wasm interop.

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
2026-02-13 07:19:09 +00:00

27 lines
774 B
Rust

use std::fmt;
/// Errors that can occur when building or running a WasmActor.
#[derive(Debug)]
pub enum WasmActorError {
/// A required export is missing from the Wasm module.
MissingExport(&'static str),
/// The Wasm module failed to compile or instantiate.
Wasmtime(wasmtime::Error),
}
impl fmt::Display for WasmActorError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MissingExport(name) => write!(f, "missing required export: `{name}`"),
Self::Wasmtime(e) => write!(f, "wasmtime error: {e}"),
}
}
}
impl std::error::Error for WasmActorError {}
impl From<wasmtime::Error> for WasmActorError {
fn from(e: wasmtime::Error) -> Self {
Self::Wasmtime(e)
}
}