From c7b9660d2888a2d81e72b8e8b5feca68f1c8b78a Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Sun, 6 Feb 2022 10:36:48 +0200 Subject: [PATCH 1/2] process: deprecate multipleResolves Deprecate the process multipleResolves event to detect when a promise is resolved more than once because it never really worked. Fixes: https://github.com/nodejs/node/issues/41554 --- doc/api/deprecations.md | 14 ++++++++++++++ doc/api/process.md | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1272c652b46085..a7b75cadf0bd2d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3070,6 +3070,20 @@ Type: End-of-Life This error code was removed due to adding more confusion to the errors used for value type validation. +### DEPXXXX: `process.on('multipleResolves, handler)` + + + +Type: Documentation-only + +This event was deprecated because it did not work with V8 promise combinators +which diminished its usefulness. + [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 diff --git a/doc/api/process.md b/doc/api/process.md index a3bd6563ded757..372f7861b149ae 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -181,8 +181,11 @@ See [Advanced serialization for `child_process`][] for more details. +> Stability: 0 - Deprecated + * `type` {string} The resolution type. One of `'resolve'` or `'reject'`. * `promise` {Promise} The promise that resolved or rejected more than once. * `value` {any} The value with which the promise was either resolved or @@ -200,6 +203,9 @@ This is useful for tracking potential errors in an application while using the the occurrence of this event does not necessarily indicate an error. For example, [`Promise.race()`][] can trigger a `'multipleResolves'` event. +Because of the unreliability of the event in cases like the +[`Promise.race()`][] example above it has been deprecated. + ```mjs import process from 'process'; From b972d681ab9989f79864f31db8b655b05c481df7 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Sun, 6 Feb 2022 11:10:47 +0200 Subject: [PATCH 2/2] Update doc/api/deprecations.md Co-authored-by: mscdex --- doc/api/deprecations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index a7b75cadf0bd2d..42ebe1d12d6a63 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3070,7 +3070,7 @@ Type: End-of-Life This error code was removed due to adding more confusion to the errors used for value type validation. -### DEPXXXX: `process.on('multipleResolves, handler)` +### DEPXXXX: `process.on('multipleResolves', handler)`