Skip to content

Commit 4864744

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

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

doc/api/deprecations.md

+22
Original file line numberDiff line numberDiff line change
@@ -3165,12 +3165,34 @@ details.
31653165
These groups might be removed in future versions of Node.js. Applications that
31663166
rely on these groups should evaluate using stronger MODP groups instead.
31673167

3168+
### DEP0168: Unhandled exception in Node-API callbacks
3169+
3170+
<!-- YAML
3171+
changes:
3172+
- version:
3173+
- v18.3.0
3174+
- v16.17.0
3175+
pr-url: https://github.com/nodejs/node/pull/36510
3176+
description: Runtime deprecation.
3177+
-->
3178+
3179+
Type: Runtime.
3180+
3181+
The implicit suppression of uncaught exceptions in Node-API callbacks is now
3182+
deprecated.
3183+
3184+
Set the flag [`--force-node-api-uncaught-exceptions-policy`][] to force Node.js
3185+
to emit an [`'uncaughtException'`][] event if the exception is not handled in
3186+
Node-API callbacks.
3187+
31683188
[Legacy URL API]: url.md#legacy-url-api
31693189
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31703190
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
31713191
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
31723192
[WHATWG URL API]: url.md#the-whatwg-url-api
31733193
[`"exports"` or `"main"` entry]: packages.md#main-entry-point-export
3194+
[`'uncaughtException'`]: process.md#event-uncaughtexception
3195+
[`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy
31743196
[`--pending-deprecation`]: cli.md#--pending-deprecation
31753197
[`--throw-deprecation`]: cli.md#--throw-deprecation
31763198
[`--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)