napi_throw_error

Function napi_throw_error 

Source
pub unsafe extern "C" fn napi_throw_error(
    env: napi_env,
    code: *const c_char,
    msg: *const c_char,
) -> napi_status
Available on crate feature napi only.
Expand description

Throws an ArkTS Error with text information.

§Arguments

  • env - Current running virtual machine context.

  • code - Optional error code to set on the error.

  • msg - C string representing the text to be associated with the error.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If env or msg is nullptr.

Available since API-level: 10