From 3956a6d648ca504eb8356187d34daedf4814d903 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 15 Nov 2026 16:22:54 +0000 Subject: [PATCH 1/2] util: revoke DEP0174 and forward promisify rejections Calling a promisified function whose original returns a Promise is a likely mistake rather than use of a deprecated API, so DEP0174 is revoked and the DeprecationWarning is replaced with a regular process warning using the code PROMISIFY_RETURNED_PROMISE. The warning is now emitted once per promisified function rather than on every call, and can be silenced with --disable-warning=PROMISIFY_RETURNED_PROMISE. Rejections of the returned Promise are now forwarded to the promise returned by the promisified function instead of being left unhandled. If the callback has already settled the result, the rejection is rethrown so that it is still reported as an unhandled rejection rather than silently swallowed. Refs: https://github.com/nodejs/node/pull/49609 Refs: https://github.com/nodejs/node/pull/49647 Refs: https://github.com/nodejs/node/issues/49607 Assisted-by: Claude Signed-off-by: James M Snell --- doc/api/deprecations.md | 13 +++- doc/api/util.md | 18 ++++++ lib/internal/util.js | 24 +++++++- .../test-util-promisify-returned-promise.js | 60 +++++++++++++++++++ test/parallel/test-util-promisify.js | 14 ----- 5 files changed, 109 insertions(+), 20 deletions(-) create mode 100644 test/parallel/test-util-promisify-returned-promise.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index fc333e937d6b..c2c8dafb7ccb 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3921,6 +3921,9 @@ The `assert.CallTracker` API has been removed. -Type: Runtime +Type: Deprecation revoked -Calling [`util.promisify`][] on a function that returns a `Promise` will ignore -the result of said promise, which can lead to unhandled promise rejections. +Calling [`util.promisify`][] on a function that returns a `Promise` used to +ignore the result of said promise, which could lead to unhandled promise +rejections. The deprecation was revoked because this is a likely mistake rather +than use of a deprecated API. Rejections of the returned `Promise` are now +forwarded to the promise returned by the promisified function, and a regular +process warning with the code `PROMISIFY_RETURNED_PROMISE` is emitted instead. ### DEP0175: `util.toUSVString` diff --git a/doc/api/util.md b/doc/api/util.md index c30831019d0e..4d62a094edbd 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -2567,6 +2567,12 @@ parseEnv('HELLO=world\nHELLO=oh my\n');