From 71615ce682524cd3e35e2b7b4523e413fa95c7df Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Tue, 13 Sep 2022 08:29:10 +0000 Subject: [PATCH] node-api: add deprecation code of uncaught exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deprecation should reference a valid deprecation code. PR-URL: https://github.com/nodejs/node/pull/44624 Refs: https://github.com/nodejs/node/pull/36510 Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson --- doc/api/deprecations.md | 24 ++++++++++++++++++++++++ src/node_api.cc | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e7c931bef47065..adeea95c50111d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3153,6 +3153,8 @@ Type: Documentation-only The [`--trace-atomics-wait`][] flag is deprecated. + + ### DEP0167: Weak `DiffieHellmanGroup` instances (`modp1`, `modp2`, `modp5`) + +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 diff --git a/src/node_api.cc b/src/node_api.cc index 922d6ffac1927b..48b94a7c12873c 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -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,