From 8b19e459092fde8cb956839cf2d27fdcdd7472ae Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 14 Sep 2023 11:30:01 +0200 Subject: [PATCH 1/2] doc: deprecate calling `promisify` on a function that returns a promise --- doc/api/deprecations.md | 15 +++++++++++++++ doc/api/util.md | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 9837d402036e28..744b7ffe113960 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3383,6 +3383,20 @@ In a future version of Node.js, [`assert.CallTracker`][], will be removed. Consider using alternatives such as the [`mock`][] helper function. +### DEP0174: calling `promisify` on a function that returns a `Promise` + + + +Type: Documentation-only + +Calling [`util.promisify`][] on a function that returns a will ignore +the result of said promise, which can lead to unhandled promise rejections. + [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 @@ -3523,6 +3537,7 @@ Consider using alternatives such as the [`mock`][] helper function. [`util.isSymbol()`]: util.md#utilissymbolobject [`util.isUndefined()`]: util.md#utilisundefinedobject [`util.log()`]: util.md#utillogstring +[`util.promisify`]: util.md#utilpromisifyoriginal [`util.types`]: util.md#utiltypes [`util`]: util.md [`worker.exitedAfterDisconnect`]: cluster.md#workerexitedafterdisconnect diff --git a/doc/api/util.md b/doc/api/util.md index 07d574694cc88a..52f081f6ade1d1 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1591,6 +1591,11 @@ $ node negate.js --no-logfile --logfile=test.log --color --no-color * `original` {Function} From 5a380cfe99d5b48bbf96a89506a8f606ccf2e1ff Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 14 Sep 2023 20:25:23 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Livia Medeiros --- doc/api/deprecations.md | 2 +- doc/api/util.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 744b7ffe113960..7cabc90b278fd8 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3388,7 +3388,7 @@ Consider using alternatives such as the [`mock`][] helper function. diff --git a/doc/api/util.md b/doc/api/util.md index 52f081f6ade1d1..af75ecb9f62cc6 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1593,7 +1593,7 @@ $ node negate.js --no-logfile --logfile=test.log --color --no-color added: v8.0.0 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/00000 + pr-url: https://github.com/nodejs/node/pull/49647 description: Calling `promisify` on a function that returns a `Promise` is deprecated. -->