From 56299f7309680792949fa01465977fd7a90a6728 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 12 Jul 2024 21:00:27 +0300 Subject: [PATCH] stream: improve inspector ergonomics PR-URL: https://github.com/nodejs/node/pull/53800 Fixes: https://github.com/nodejs/node/issues/53789 Reviewed-By: James M Snell Reviewed-By: Yagiz Nizipli Reviewed-By: Marco Ippolito --- lib/internal/webstreams/readablestream.js | 4 ++-- lib/internal/webstreams/writablestream.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index a0bf7075306c01..3e169580d3df4a 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -2034,8 +2034,8 @@ function readableStreamError(stream, error) { assert(stream[kState].state === 'readable'); stream[kState].state = 'errored'; stream[kState].storedError = error; - stream[kIsClosedPromise].reject(error); setPromiseHandled(stream[kIsClosedPromise].promise); + stream[kIsClosedPromise].reject(error); const { reader, @@ -2044,8 +2044,8 @@ function readableStreamError(stream, error) { if (reader === undefined) return; - reader[kState].close.reject(error); setPromiseHandled(reader[kState].close.promise); + reader[kState].close.reject(error); if (readableStreamHasDefaultReader(stream)) { for (let n = 0; n < reader[kState].readRequests.length; n++) diff --git a/lib/internal/webstreams/writablestream.js b/lib/internal/webstreams/writablestream.js index 75a9453ad490e9..70c470bac845f6 100644 --- a/lib/internal/webstreams/writablestream.js +++ b/lib/internal/webstreams/writablestream.js @@ -761,15 +761,15 @@ function writableStreamRejectCloseAndClosedPromiseIfNeeded(stream) { }; } - stream[kIsClosedPromise].reject(stream[kState]?.storedError); setPromiseHandled(stream[kIsClosedPromise].promise); + stream[kIsClosedPromise].reject(stream[kState]?.storedError); const { writer, } = stream[kState]; if (writer !== undefined) { - writer[kState].close.reject?.(stream[kState].storedError); setPromiseHandled(writer[kState].close.promise); + writer[kState].close.reject?.(stream[kState].storedError); } }