Skip to content

Commit

Permalink
fixup! TSFN fatal uncaught exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielschulhof committed Dec 25, 2024
1 parent 69e4d6a commit e9de692
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ will not be freed. This can be avoided by calling

**Change History:**

* Experimental (`NAPI_EXPERIMENTAL` is defined):
* Version 10 (`NAPI_VERSION` is defined as `10` or higher):

References can be created for all value types. The new supported value
types do not support weak reference semantic and the values of these types
Expand Down Expand Up @@ -6527,7 +6527,7 @@ napi_create_threadsafe_function(napi_env env,

**Change History:**

* Experimental (`NAPI_EXPERIMENTAL` is defined):
* Version 10 (`NAPI_VERSION` is defined as `10` or higher):

Uncaught exceptions thrown in `call_js_cb` are handled with the
[`'uncaughtException'`][] event, instead of being ignored.
Expand Down
10 changes: 5 additions & 5 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ void node_napi_env__::CallbackIntoModule(T&& call) {
return;
}
node::Environment* node_env = env->node_env();
// If the module api version is less than NAPI_VERSION_EXPERIMENTAL,
// and the option --force-node-api-uncaught-exceptions-policy is not
// specified, emit a warning about the uncaught exception instead of
// triggering uncaught exception event.
if (env->module_api_version < NAPI_VERSION_EXPERIMENTAL &&
// If the module api version is less than 10, and the option
// --force-node-api-uncaught-exceptions-policy is not specified, emit a
// warning about the uncaught exception instead of triggering the uncaught
// exception event.
if (env->module_api_version < 10 &&
!node_env->options()->force_node_api_uncaught_exceptions_policy &&
!enforceUncaughtExceptionPolicy) {
ProcessEmitDeprecationWarning(
Expand Down

0 comments on commit e9de692

Please sign in to comment.