Skip to main content

napi_throw_business_error

Function napi_throw_business_error 

Source
pub unsafe extern "C" fn napi_throw_business_error(
    env: napi_env,
    errorCode: i32,
    msg: *const c_char,
) -> napi_status
Available on crate features napi and api-23 only.
Expand description

Throws an ArkTS Error with text information.

§Arguments

  • env - Current running virtual machine context.

  • errorCode - Error code to be set on the error object.

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

§Returns

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

[napi_invalid_arg] If env or msg is nullptr.

[napi_pending_exception] There is an uncaught exception occurred before execution.

Available since API-level: 23