10#ifdef WASMTIME_FEATURE_GC
35 std::unique_ptr<wasmtime_exn_t, deleter> ptr;
58 const std::vector<Val> &fields) {
62 reinterpret_cast<const wasmtime_val_t *
>(fields.data()), fields.size(),
64 if (error !=
nullptr) {
74 if (error !=
nullptr) {
89 if (error !=
nullptr) {
Errors coming from Wasmtime.
Definition: error.hh:26
A WebAssembly exception object.
Definition: exn.hh:30
Result< Tag > tag(Store::Context cx) const
Returns the tag associated with this exception.
Definition: exn.hh:71
~Exn()=default
Destroys an exception.
Exn(Exn &&other)=default
Constructs a new exception.
static Result< Exn > create(Store::Context cx, const Tag &tag, const std::vector< Val > &fields)
Create a new exception object.
Definition: exn.hh:57
wasmtime_exn_t * capi() const
Returns the raw underlying C API pointer (non-owning).
Definition: exn.hh:96
Exn & operator=(Exn &&other)=default
Moves an exception.
Exn(wasmtime_exn_t *raw)
Takes ownership of a raw wasmtime_exn_t pointer.
Definition: exn.hh:39
wasmtime_exn_t * release()
Releases ownership of the underlying C API pointer.
Definition: exn.hh:99
Result< Val > field(Store::Context cx, size_t index) const
Reads a field value by index.
Definition: exn.hh:86
size_t field_count(Store::Context cx) const
Returns the number of fields in this exception.
Definition: exn.hh:81
Fallible result type used for Wasmtime.
Definition: error.hh:70
An interior pointer into a Store.
Definition: store.hh:69
Trap throw_exception(Exn exn)
Sets the pending exception on the store and returns a Trap.
Definition: exn.hh:102
bool has_exception()
Tests whether there is a pending exception on the store.
Definition: exn.hh:114
std::optional< Exn > take_exception()
Takes the pending exception from the store, if any.
Definition: exn.hh:106
const wasmtime_context_t * capi() const
Returns the underlying C API pointer.
Definition: store.hh:190
A WebAssembly tag.
Definition: tag.hh:26
Information about a WebAssembly trap.
Definition: trap.hh:113
Representation of a generic WebAssembly value.
Definition: val.hh:240
Build-time defines for how the C API was built.
Wasmtime APIs for WebAssembly exception objects.
struct wasmtime_exn wasmtime_exn_t
An opaque type representing a WebAssembly exception object.
Definition: exn.h:54
WASM_API_EXTERN size_t wasmtime_exn_field_count(wasmtime_context_t *store, const wasmtime_exn_t *exn)
Returns the number of fields in this exception.
WASM_API_EXTERN wasmtime_error_t * wasmtime_exn_tag(wasmtime_context_t *store, const wasmtime_exn_t *exn, wasmtime_tag_t *tag_ret)
Returns the tag associated with this exception.
WASM_API_EXTERN wasmtime_error_t * wasmtime_exn_field(wasmtime_context_t *store, const wasmtime_exn_t *exn, size_t index, wasmtime_val_t *val_ret)
Reads a field value from this exception by index.
WASM_API_EXTERN void wasmtime_exn_delete(wasmtime_exn_t *exn)
Deletes a wasmtime_exn_t.
WASM_API_EXTERN wasmtime_error_t * wasmtime_exn_new(wasmtime_context_t *store, const wasmtime_tag_t *tag, const wasmtime_val_t *fields, size_t nfields, wasmtime_exn_t **exn_ret)
Creates a new exception object.
WASM_API_EXTERN bool wasmtime_context_has_exception(wasmtime_context_t *store)
Tests whether there is a pending exception on the store.
WASM_API_EXTERN bool wasmtime_context_take_exception(wasmtime_context_t *store, wasmtime_exn_t **exn_ret)
Takes the pending exception from the store, if any.
WASM_API_EXTERN wasm_trap_t * wasmtime_context_set_exception(wasmtime_context_t *store, wasmtime_exn_t *exn)
Sets the pending exception on the store and returns a trap.
Representation of a tag in Wasmtime.
Definition: tag.h:28
Container for different kinds of wasm values.
Definition: val.h:546