napi_is_exception_pending


napi_status napi_is_exception_pending(napi_env env, bool* result); 
  • [in] env:调用该 API 时所处的环境。
  • [out] result:布尔值,如果有异常待处理,则设置为 true。

如果 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.】