summaryrefslogtreecommitdiff
path: root/lib/_stream_writable.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_stream_writable.js')
-rw-r--r--lib/_stream_writable.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
index 403cb7b47..257a400fa 100644
--- a/lib/_stream_writable.js
+++ b/lib/_stream_writable.js
@@ -104,6 +104,9 @@ function WritableState(options, stream) {
this.writelen = 0;
this.buffer = [];
+
+ // True if the error was already emitted and should not be thrown again
+ this.errorEmitted = false;
}
function Writable(options) {
@@ -232,6 +235,7 @@ function onwriteError(stream, state, sync, er, cb) {
else
cb(er);
+ stream._writableState.errorEmitted = true;
stream.emit('error', er);
}