diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 77cc49946c4231..ee1ad68c4cff84 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -580,7 +580,8 @@ typedef enum { napi_arraybuffer_expected, napi_detachable_arraybuffer_expected, napi_would_deadlock, /* unused */ - napi_no_external_buffers_allowed + napi_no_external_buffers_allowed, + napi_cannot_run_js } napi_status; ``` @@ -814,6 +815,18 @@ typedef void (*napi_finalize)(napi_env env, Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside the function body is not necessary. +Since these functions may be called while the JavaScript engine is in a state +where it cannot execute JavaScript code, some Node-API calls may return +`napi_pending_exception` even when there is no exception pending. + +Change History: + +* experimental (`NAPI_EXPERIMENTAL` is defined): + + Node-API calls made from a finalizer will return `napi_cannot_run_js` when + the JavaScript engine is unable to execute JavaScript, and will return + `napi_exception_pending` if there is a pending exception. + #### `napi_async_execute_callback`