stream: unify writableErrored and readableErrored · nodejs/node@340b770 · GitHub
Skip to content

Commit 340b770

Browse files
committed
stream: unify writableErrored and readableErrored
Both of these should always refer to the same error, hence there is no reason to separate them. PR-URL: #40799 Refs: #40696 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2b0087f commit 340b770

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

doc/api/stream.md

Lines changed: 2 additions & 2 deletions

lib/internal/streams/readable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ ObjectDefineProperties(Readable.prototype, {
12421242
}
12431243
},
12441244

1245-
readableErrored: {
1245+
errored: {
12461246
enumerable: false,
12471247
get() {
12481248
return this._readableState ? this._readableState.errored : null;

lib/internal/streams/writable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ ObjectDefineProperties(Writable.prototype, {
858858
}
859859
},
860860

861-
writableErrored: {
861+
errored: {
862862
enumerable: false,
863863
get() {
864864
return this._writableState ? this._writableState.errored : null;

test/parallel/test-stream-finished.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
612612
const w = new Writable();
613613
const _err = new Error();
614614
w.destroy(_err);
615-
assert.strictEqual(w.writableErrored, _err);
615+
assert.strictEqual(w.errored, _err);
616616
finished(w, common.mustCall((err) => {
617617
assert.strictEqual(_err, err);
618618
assert.strictEqual(w.closed, true);
@@ -625,7 +625,7 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
625625
{
626626
const w = new Writable();
627627
w.destroy();
628-
assert.strictEqual(w.writableErrored, null);
628+
assert.strictEqual(w.errored, null);
629629
finished(w, common.mustCall((err) => {
630630
assert.strictEqual(w.closed, true);
631631
assert.strictEqual(err.code, 'ERR_STREAM_PREMATURE_CLOSE');

test/parallel/test-stream-readable-destroy.js

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)