Sha256: eaa3c08c9ac943e806a14b2fa5602d3b11878528ed7ef00b97e225470c5726fc

Contents?: true

Size: 1.06 KB

Versions: 22

Compression:

Stored size: 1.06 KB

Contents

//! wasi-common uses an [`Error`] type which represents either a preview 1 [`Errno`] enum, on
//! [`anyhow::Error`] for trapping execution.
//!
//! The user can construct an [`Error`] out of an [`Errno`] using the `From`/`Into` traits.
//! They may also use [`Error::trap`] to construct an error that traps execution. The contents
//! can be inspected with [`Error::downcast`] and [`Error::downcast_ref`]. Additional context
//! can be provided with the [`Error::context`] method. This context is only observable with the
//! `Display` and `Debug` impls of the error.

pub use crate::snapshots::preview_1::error::{Errno, Error, ErrorExt};
use std::fmt;

/// An error returned from the `proc_exit` host syscall.
///
/// Embedders can test if an error returned from wasm is this error, in which
/// case it may signal a non-fatal trap.
#[derive(Debug)]
pub struct I32Exit(pub i32);

impl fmt::Display for I32Exit {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "Exited with i32 exit status {}", self.0)
    }
}

impl std::error::Error for I32Exit {}

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
wasmtime-16.0.0 ./ext/cargo-vendor/wasi-common-16.0.0/src/error.rs
wasmtime-15.0.1 ./ext/cargo-vendor/wasi-common-15.0.1/src/error.rs
wasmtime-15.0.0 ./ext/cargo-vendor/wasi-common-15.0.0/src/error.rs
wasmtime-14.0.4 ./ext/cargo-vendor/wasi-common-14.0.4/src/error.rs
wasmtime-14.0.3 ./ext/cargo-vendor/wasi-common-14.0.3/src/error.rs
wasmtime-14.0.1 ./ext/cargo-vendor/wasi-common-14.0.1/src/error.rs
wasmtime-14.0.0 ./ext/cargo-vendor/wasi-common-14.0.0/src/error.rs
wasmtime-13.0.0 ./ext/cargo-vendor/wasi-common-13.0.0/src/error.rs
wasmtime-12.0.1 ./ext/cargo-vendor/wasi-common-12.0.1/src/error.rs
wasmtime-12.0.0 ./ext/cargo-vendor/wasi-common-12.0.0/src/error.rs
wasmtime-11.0.0 ./ext/cargo-vendor/wasi-common-11.0.0/src/error.rs
wasmtime-10.0.1 ./ext/cargo-vendor/wasi-common-10.0.1/src/error.rs
wasmtime-10.0.0 ./ext/cargo-vendor/wasi-common-10.0.0/src/error.rs
wasmtime-9.0.4 ./ext/cargo-vendor/wasi-common-9.0.4/src/error.rs
wasmtime-9.0.1 ./ext/cargo-vendor/wasi-common-9.0.1/src/error.rs
wasmtime-8.0.0 ./ext/cargo-vendor/wasi-common-8.0.0/src/error.rs
wasmtime-7.0.0 ./ext/cargo-vendor/wasi-common-7.0.0/src/error.rs
wasmtime-6.0.1 ./ext/cargo-vendor/wasi-common-6.0.1/src/error.rs
wasmtime-6.0.0 ./ext/cargo-vendor/wasi-common-6.0.0/src/error.rs
wasmtime-5.0.0 ./ext/cargo-vendor/wasi-common-5.0.0/src/error.rs