MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / wasmtime_context_set_exception

Function wasmtime_context_set_exception

crates/c-api/src/exnref.rs:85–95  ·  view source on GitHub ↗
(
    mut store: WasmtimeStoreContextMut<'_>,
    exn: &wasmtime_exnref_t,
)

Source from the content-addressed store, hash-verified

83
84#[unsafe(no_mangle)]
85pub unsafe extern "C" fn wasmtime_context_set_exception(
86 mut store: WasmtimeStoreContextMut<'_>,
87 exn: &wasmtime_exnref_t,
88) -> Option<Box<wasm_trap_t>> {
89 let mut scope = RootScope::new(&mut store);
90 let rooted = exn.as_wasmtime()?.to_rooted(&mut scope);
91 let Err(thrown) = scope
92 .as_context_mut()
93 .throw::<std::convert::Infallible>(rooted);
94 Some(Box::new(wasm_trap_t::new(thrown)))
95}
96
97#[unsafe(no_mangle)]
98pub extern "C" fn wasmtime_context_take_exception(

Callers 1

throw_exceptionMethod · 0.85

Calls 4

as_wasmtimeMethod · 0.80
newFunction · 0.50
to_rootedMethod · 0.45
as_context_mutMethod · 0.45

Tested by

no test coverage detected