1 /** 2 * \file wasmtime/error.h 3 * 4 * \brief Definition and accessors of #wasmtime_error_t 5 */ 6 7 #ifndef WASMTIME_ERROR_H 8 #define WASMTIME_ERROR_H 9 10 #include <wasm.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * \typedef wasmtime_error_t 18 * \brief Convenience alias for #wasmtime_error 19 * 20 * \struct wasmtime_error 21 * \brief Errors generated by Wasmtime. 22 * \headerfile wasmtime/error.h 23 * 24 * This opaque type represents an error that happened as part of one of the 25 * functions below. Errors primarily have an error message associated with them 26 * at this time, which you can acquire by calling #wasmtime_error_message. 27 * 28 * Errors are safe to share across threads and must be deleted with 29 * #wasmtime_error_delete. 30 */ 31 typedef struct wasmtime_error wasmtime_error_t; 32 33 /** 34 * \brief Deletes an error. 35 */ 36 WASM_API_EXTERN void wasmtime_error_delete(wasmtime_error_t *error); 37 38 /** 39 * \brief Returns the string description of this error. 40 * 41 * This will "render" the error to a string and then return the string 42 * representation of the error to the caller. The `message` argument should be 43 * uninitialized before this function is called and the caller is responsible 44 * for deallocating it with #wasm_byte_vec_delete afterwards. 45 */ 46 WASM_API_EXTERN void wasmtime_error_message( 47 const wasmtime_error_t *error, 48 wasm_name_t *message 49 ); 50 51 #ifdef __cplusplus 52 } // extern "C" 53 #endif 54 55 #endif // WASMTIME_ERROR_H 56