Skip to content

Commit

Permalink
node-api: add deprecation code of uncaught exception
Browse files Browse the repository at this point in the history
Deprecation should reference a valid deprecation code.

PR-URL: #44624
Refs: #36510
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
legendecas authored and juanarbol committed Oct 11, 2022
1 parent 7e07cce commit adae66c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3153,6 +3153,8 @@ Type: Documentation-only

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

<!-- md-lint skip-deprecation DEP0166 -->

### DEP0167: Weak `DiffieHellmanGroup` instances (`modp1`, `modp2`, `modp5`)

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

### DEP0168: Unhandled exception in Node-API callbacks

<!-- YAML
changes:
- version:
- v18.3.0
- v16.17.0
pr-url: https://github.com/nodejs/node/pull/36510
description: Runtime deprecation.
-->

Type: Runtime.

The implicit suppression of uncaught exceptions in Node-API callbacks is now
deprecated.

Set the flag [`--force-node-api-uncaught-exceptions-policy`][] to force Node.js
to emit an [`'uncaughtException'`][] event if the exception is not handled in
Node-API callbacks.

[Legacy URL API]: url.md#legacy-url-api
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
[WHATWG URL API]: url.md#the-whatwg-url-api
[`"exports"` or `"main"` entry]: packages.md#main-entry-point-export
[`'uncaughtException'`]: process.md#event-uncaughtexception
[`--force-node-api-uncaught-exceptions-policy`]: cli.md#--force-node-api-uncaught-exceptions-policy
[`--pending-deprecation`]: cli.md#--pending-deprecation
[`--throw-deprecation`]: cli.md#--throw-deprecation
[`--trace-atomics-wait`]: cli.md#--trace-atomics-wait
Expand Down
2 changes: 1 addition & 1 deletion src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void node_napi_env__::CallbackIntoModule(T&& call) {
"Uncaught N-API callback exception detected, please run node "
"with option --force-node-api-uncaught-exceptions-policy=true"
"to handle those exceptions properly.",
"DEP0XXX");
"DEP0168");
return;
}
// If there was an unhandled exception in the complete callback,
Expand Down

0 comments on commit adae66c

Please sign in to comment.