Skip to content

Commit 341e8ce

Browse files
legendecasguangwong
authored andcommitted
node-api: add deprecation code of uncaught exception
Deprecation should reference a valid deprecation code. PR-URL: nodejs/node#44624 Refs: nodejs/node#36510 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent bb79ee2 commit 341e8ce

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

doc/api/deprecations.md

+24
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,8 @@ Type: Documentation-only
31533153

31543154
The [`--trace-atomics-wait`][] flag is deprecated.
31553155

3156+
<!-- md-lint skip-deprecation DEP0166 -->
3157+
31563158
### DEP0167: Weak `DiffieHellmanGroup` instances (`modp1`, `modp2`, `modp5`)
31573159

31583160
<!-- YAML
@@ -3171,12 +3173,34 @@ details.
31713173
These groups might be removed in future versions of Node.js. Applications that
31723174
rely on these groups should evaluate using stronger MODP groups instead.
31733175

3176+
### DEP0168: Unhandled exception in Node-API callbacks
3177+
3178+
<!-- YAML
3179+
changes:
3180+
- version:
3181+
- v18.3.0
3182+
- v16.17.0
3183+
pr-url: https://github.com/nodejs/node/pull/36510
3184+
description: Runtime deprecation.
3185+
-->
3186+
3187+
Type: Runtime.
3188+
3189+
The implicit suppression of uncaught exceptions in Node-API callbacks is now
3190+
deprecated.
3191+
3192+
Set the flag [`--force-node-api-uncaught-exceptions-policy`][] to force Node.js
3193+
to emit an [`'uncaughtException'`][] event if the exception is not handled in
3194+
Node-API callbacks.
3195+
31743196
[Legacy URL API]: url.md#legacy-url-api
31753197
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31763198
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
31773199
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
31783200
[WHATWG URL API]: url.md#the-whatwg-url-api
31793201
[`"exports"` or `"main"` entry]: packages.md#main-entry-point-export
3202+
[`'uncaughtException'`]: process.md#event-uncaughtexception
3203+
[`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy
31803204
[`--pending-deprecation`]: cli.md#--pending-deprecation
31813205
[`--throw-deprecation`]: cli.md#--throw-deprecation
31823206
[`--trace-atomics-wait`]: cli.md#--trace-atomics-wait

src/node_api.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void node_napi_env__::CallbackIntoModule(T&& call) {
9090
"Uncaught N-API callback exception detected, please run node "
9191
"with option --force-node-api-uncaught-exceptions-policy=true"
9292
"to handle those exceptions properly.",
93-
"DEP0XXX");
93+
"DEP0168");
9494
return;
9595
}
9696
// If there was an unhandled exception in the complete callback,

0 commit comments

Comments
 (0)