Wasmtime
exn.h
Go to the documentation of this file.
1
29#ifndef WASMTIME_EXN_H
30#define WASMTIME_EXN_H
31
32#include <wasmtime/conf.h>
33
34#ifdef WASMTIME_FEATURE_GC
35
36#include <wasm.h>
37#include <wasmtime/error.h>
38#include <wasmtime/store.h>
39#include <wasmtime/tag.h>
40#include <wasmtime/val.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
54typedef struct wasmtime_exn wasmtime_exn_t;
55
59WASM_API_EXTERN void wasmtime_exn_delete(wasmtime_exn_t *exn);
60
76 const wasmtime_tag_t *tag,
77 const wasmtime_val_t *fields,
78 size_t nfields,
79 wasmtime_exn_t **exn_ret);
80
91 const wasmtime_exn_t *exn,
92 wasmtime_tag_t *tag_ret);
93
100WASM_API_EXTERN size_t wasmtime_exn_field_count(wasmtime_context_t *store,
101 const wasmtime_exn_t *exn);
102
115 const wasmtime_exn_t *exn,
116 size_t index,
117 wasmtime_val_t *val_ret);
118
133WASM_API_EXTERN wasm_trap_t *
135
149 wasmtime_exn_t **exn_ret);
150
159
160#ifdef __cplusplus
161} // extern "C"
162#endif
163
164#endif // WASMTIME_FEATURE_GC
165
166#endif // WASMTIME_EXN_H
Build-time defines for how the C API was built.
Definition and accessors of wasmtime_error_t.
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.
Opaque struct representing a wasm trap.
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
Errors generated by Wasmtime.
Representation of a tag in Wasmtime.
Definition: tag.h:28
Container for different kinds of wasm values.
Definition: val.h:541
Wasmtime APIs for interacting with WebAssembly tags.