Skip to content

Commit ed1d634

Browse files
legendecasRafaelGSS
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 6606a11 commit ed1d634

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

3220+
### DEP0168: Unhandled exception in Node-API callbacks
3221+
3222+
<!-- YAML
3223+
changes:
3224+
- version:
3225+
- v18.3.0
3226+
- v16.17.0
3227+
pr-url: https://github.com/nodejs/node/pull/36510
3228+
description: Runtime deprecation.
3229+
-->
3230+
3231+
Type: Runtime.
3232+
3233+
The implicit suppression of uncaught exceptions in Node-API callbacks is now
3234+
deprecated.
3235+
3236+
Set the flag [`--force-node-api-uncaught-exceptions-policy`][] to force Node.js
3237+
to emit an [`'uncaughtException'`][] event if the exception is not handled in
3238+
Node-API callbacks.
3239+
32203240
[Legacy URL API]: url.md#legacy-url-api
32213241
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
32223242
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
32233243
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
32243244
[WHATWG URL API]: url.md#the-whatwg-url-api
32253245
[`"exports"` or `"main"` entry]: packages.md#main-entry-point-export
3246+
[`'uncaughtException'`]: process.md#event-uncaughtexception
3247+
[`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy
32263248
[`--pending-deprecation`]: cli.md#--pending-deprecation
32273249
[`--throw-deprecation`]: cli.md#--throw-deprecation
32283250
[`--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)