/** * \file wasmi/error.h * * \brief Wasmi-specific extensions to #wasm_error_t */ #ifndef WASMI_ERROR_H #define WASMI_ERROR_H #include #define own #ifdef __cplusplus extern "C" { #endif /** * \typedef wasmi_error_t * \brief Convenience alias for #wasmi_error * * \struct wasmi_error * \brief Errors generated by Wasmi. * \headerfile wasmi/error.h * * This opaque error type represents any Wasmi error that might occur * upon interoperating with Wasmi. Each error has an error message associated * to it which can be queried. * * Errors are safe to share across threads and must be deleted with * #wasmi_error_delete. */ typedef struct wasmi_error wasmi_error_t; /** * \brief Creates a new Wasmi error with the provided message. */ WASM_API_EXTERN own wasmi_error_t *wasmi_error_new(const char *); /** * \brief Deletes the Wasmi error. */ WASM_API_EXTERN void wasmi_error_delete(own wasmi_error_t *error); /** * \brief Returns the string description of this #wasmi_error_t. * * 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. */ WASM_API_EXTERN void wasmi_error_message(const wasmi_error_t *error, wasm_name_t *message); #ifdef __cplusplus } // extern "C" #endif #undef own #endif // WASMI_ERROR_H