Skip to content

Commit a280920

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 35f1362 commit a280920

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
@@ -3171,12 +3171,34 @@ details.
31713171
These groups might be removed in future versions of Node.js. Applications that
31723172
rely on these groups should evaluate using stronger MODP groups instead.
31733173

3174+
### DEP0168: Unhandled exception in Node-API callbacks
3175+
3176+
<!-- YAML
3177+
changes:
3178+
- version:
3179+
- v18.3.0
3180+
- v16.17.0
3181+
pr-url: https://github.com/nodejs/node/pull/36510
3182+
description: Runtime deprecation.
3183+
-->
3184+
3185+
Type: Runtime.
3186+
3187+
The implicit suppression of uncaught exceptions in Node-API callbacks is now
3188+
deprecated.
3189+
3190+
Set the flag [`--force-node-api-uncaught-exceptions-policy`][] to force Node.js
3191+
to emit an [`'uncaughtException'`][] event if the exception is not handled in
3192+
Node-API callbacks.
3193+
31743194
[Legacy URL API]: url.md#legacy-url-api
31753195
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
31763196
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
31773197
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
31783198
[WHATWG URL API]: url.md#the-whatwg-url-api
31793199
[`"exports"` or `"main"` entry]: packages.md#main-entry-point-export
3200+
[`'uncaughtException'`]: process.md#event-uncaughtexception
3201+
[`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy
31803202
[`--pending-deprecation`]: cli.md#--pending-deprecation
31813203
[`--throw-deprecation`]: cli.md#--throw-deprecation
31823204
[`--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)