Skip to content

Commit

Permalink
stream: improve inspector ergonomics
Browse files Browse the repository at this point in the history
PR-URL: nodejs#53800
Fixes: nodejs#53789
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
benjamingr authored and ehsankhfr committed Jul 18, 2024
1 parent 307dcc0 commit ac584b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2041,8 +2041,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,
Expand All @@ -2051,8 +2051,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++)
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,15 +768,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);
}
}

Expand Down

0 comments on commit ac584b6

Please sign in to comment.