We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de85b1e commit 67ca62aCopy full SHA for 67ca62a
lib/internal/streams/writable.js
@@ -514,12 +514,12 @@ function errorBuffer(state) {
514
const { chunk, callback } = state.buffered[n];
515
const len = state.objectMode ? 1 : chunk.length;
516
state.length -= len;
517
- callback(new ERR_STREAM_DESTROYED('write'));
+ callback(state.errored ?? new ERR_STREAM_DESTROYED('write'));
518
}
519
520
const onfinishCallbacks = state[kOnFinished].splice(0);
521
for (let i = 0; i < onfinishCallbacks.length; i++) {
522
- onfinishCallbacks[i](new ERR_STREAM_DESTROYED('end'));
+ onfinishCallbacks[i](state.errored ?? new ERR_STREAM_DESTROYED('end'));
523
524
525
resetBuffer(state);
0 commit comments