jsdet-core 0.1.0

Core WASM-sandboxed JavaScript detonation engine
Documentation
/// Errors produced by the jsdet sandbox.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// WASM module failed to compile or instantiate.
    #[error("wasm initialization failed: {0}")]
    WasmInit(String),

    /// Execution exceeded the configured fuel budget.
    #[error("execution exceeded fuel budget ({budget} fuel units)")]
    FuelExhausted { budget: u64 },

    /// Execution exceeded the configured wall-clock timeout.
    #[error("execution exceeded {timeout_ms}ms timeout")]
    Timeout { timeout_ms: u64 },

    /// WASM linear memory exceeded the configured limit.
    #[error("linear memory exceeded {limit_bytes} byte limit")]
    MemoryExceeded { limit_bytes: usize },

    /// A bridge call returned an error.
    #[error("bridge error in {api}: {message}")]
    Bridge { api: String, message: String },

    /// The WASM module trapped (unreachable, divide by zero, etc.).
    #[error("wasm trap: {0}")]
    Trap(String),

    /// Internal error — should not happen in normal operation.
    #[error("internal: {0}")]
    Internal(String),
}

pub type Result<T> = std::result::Result<T, Error>;