Wasmtime
error.h File Reference

Definition and accessors of wasmtime_error_t. More...

#include <wasm.h>

Go to the source code of this file.

Typedefs

typedef struct wasmtime_error wasmtime_error_t
 Convenience alias for wasmtime_error.
 

Functions

wasmtime_error_twasmtime_error_new (const char *)
 Creates a new error with the provided message.
 
void wasmtime_error_delete (wasmtime_error_t *error)
 Deletes an error.
 
void wasmtime_error_message (const wasmtime_error_t *error, wasm_name_t *message)
 Returns the string description of this error. More...
 
bool wasmtime_error_exit_status (const wasmtime_error_t *, int *status)
 Attempts to extract a WASI-specific exit status from this error. More...
 
void wasmtime_error_wasm_trace (const wasmtime_error_t *, wasm_frame_vec_t *out)
 Attempts to extract a WebAssembly trace from this error. More...
 

Detailed Description

Definition and accessors of wasmtime_error_t.

Function Documentation

◆ wasmtime_error_exit_status()

bool wasmtime_error_exit_status ( const wasmtime_error_t ,
int *  status 
)

Attempts to extract a WASI-specific exit status from this error.

Returns true if the error is a WASI "exit" trap and has a return status. If true is returned then the exit status is returned through the status pointer. If false is returned then this is not a wasi exit trap.

◆ wasmtime_error_message()

void wasmtime_error_message ( const wasmtime_error_t error,
wasm_name_t message 
)

Returns the string description of this error.

This will "render" the error to a string and then return the string representation of the error to the caller. The message argument should be uninitialized before this function is called and the caller is responsible for deallocating it with wasm_byte_vec_delete afterwards.

◆ wasmtime_error_wasm_trace()

void wasmtime_error_wasm_trace ( const wasmtime_error_t ,
wasm_frame_vec_t out 
)

Attempts to extract a WebAssembly trace from this error.

This is similar to wasm_trap_trace except that it takes a wasmtime_error_t as input. The out argument will be filled in with the wasm trace, if present.