Skip to content

Commit e9de692

Browse files
fixup! TSFN fatal uncaught exception handling
1 parent 69e4d6a commit e9de692

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

doc/api/n-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ will not be freed. This can be avoided by calling
17481748

17491749
**Change History:**
17501750

1751-
* Experimental (`NAPI_EXPERIMENTAL` is defined):
1751+
* Version 10 (`NAPI_VERSION` is defined as `10` or higher):
17521752

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

65286528
**Change History:**
65296529

6530-
* Experimental (`NAPI_EXPERIMENTAL` is defined):
6530+
* Version 10 (`NAPI_VERSION` is defined as `10` or higher):
65316531

65326532
Uncaught exceptions thrown in `call_js_cb` are handled with the
65336533
[`'uncaughtException'`][] event, instead of being ignored.

src/node_api.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ void node_napi_env__::CallbackIntoModule(T&& call) {
9393
return;
9494
}
9595
node::Environment* node_env = env->node_env();
96-
// If the module api version is less than NAPI_VERSION_EXPERIMENTAL,
97-
// and the option --force-node-api-uncaught-exceptions-policy is not
98-
// specified, emit a warning about the uncaught exception instead of
99-
// triggering uncaught exception event.
100-
if (env->module_api_version < NAPI_VERSION_EXPERIMENTAL &&
96+
// If the module api version is less than 10, and the option
97+
// --force-node-api-uncaught-exceptions-policy is not specified, emit a
98+
// warning about the uncaught exception instead of triggering the uncaught
99+
// exception event.
100+
if (env->module_api_version < 10 &&
101101
!node_env->options()->force_node_api_uncaught_exceptions_policy &&
102102
!enforceUncaughtExceptionPolicy) {
103103
ProcessEmitDeprecationWarning(

0 commit comments

Comments
 (0)