stream: convert premature close to AbortError · nodejs/node@3f0b623 · GitHub
Skip to content

Commit 3f0b623

Browse files
committed
stream: convert premature close to AbortError
AbortError is a more "web" align alternative to ERR_STREAM_PREMATURE_CLOSE. PR-URL: #39524 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b14fb01 commit 3f0b623

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

lib/internal/webstreams/adapters.js

Lines changed: 14 additions & 1 deletion

test/parallel/test-whatwg-webstreams-adapters-to-readablestream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const {
5959
const reader = readableStream.getReader();
6060

6161
assert.rejects(reader.closed, {
62-
code: 'ERR_STREAM_PREMATURE_CLOSE',
62+
code: 'ABORT_ERR',
6363
});
6464

6565
readable.on('end', common.mustNotCall());

test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const {
2727
const writer = writable.getWriter();
2828

2929
assert.rejects(reader.closed, {
30-
code: 'ERR_STREAM_PREMATURE_CLOSE',
30+
code: 'ABORT_ERR',
3131
});
3232

3333
assert.rejects(writer.closed, {
34-
code: 'ERR_STREAM_PREMATURE_CLOSE',
34+
code: 'ABORT_ERR',
3535
});
3636

3737
duplex.destroy();
@@ -165,7 +165,7 @@ const {
165165

166166
reader.closed.then(common.mustCall());
167167
assert.rejects(writer.closed, {
168-
code: 'ERR_STREAM_PREMATURE_CLOSE',
168+
code: 'ABORT_ERR',
169169
});
170170

171171
duplex.end();

test/parallel/test-whatwg-webstreams-adapters-to-writablestream.js

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)