napi_get_and_clear_last_exception


napi_status napi_get_and_clear_last_exception(napi_env env,
                                              napi_value* result); 
  • [in] env:调用 API 的环境。

    ¥[in] env: The environment that the API is invoked under.

  • [out] result:如果一个未决则异常,否则为 NULL

    ¥[out] result: The exception if one is pending, NULL otherwise.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

即使存在挂起的 JavaScript 异常,也可以调用此 API。

¥This API can be called even if there is a pending JavaScript exception.