From 02924b06099525f976a400b4e2193caa27aa29c0 Mon Sep 17 00:00:00 2001 From: ratikesh Date: Tue, 12 Jul 2016 08:32:23 +0545 Subject: [PATCH 1/3] errorMessage: Improvement in the error thrown in case of writable stream write method Files changes include the fix for issue Fixes: https://github.com/nodejs/node/issues/7396 --- lib/_stream_writable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 76c4972d405c81..c3a11df92ce025 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -197,6 +197,7 @@ function validChunk(stream, state, chunk, cb) { } Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; var ret = false; @@ -305,6 +306,7 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) { stream._writev(chunk, state.onwrite); else stream._write(chunk, encoding, state.onwrite); + state.sync = false; } @@ -432,7 +434,7 @@ function clearBuffer(stream, state) { } Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); + //cb(new Error('not implemented')); }; Writable.prototype._writev = null; From 741d2fe6f3c319bc255262d62559ee1a66f8724d Mon Sep 17 00:00:00 2001 From: ratikesh9 Date: Tue, 12 Jul 2016 15:40:10 +0545 Subject: [PATCH 2/3] Update _stream_writable.js --- lib/_stream_writable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index c3a11df92ce025..f3c302816a252a 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -434,7 +434,7 @@ function clearBuffer(stream, state) { } Writable.prototype._write = function(chunk, encoding, cb) { - //cb(new Error('not implemented')); + cb(new Error('Write method cannot be invoked on the Writable stream . Method not implemented')); }; Writable.prototype._writev = null; From c2108c7c1135e37eadaa7ad1861381446dd21890 Mon Sep 17 00:00:00 2001 From: ratikesh9 Date: Tue, 12 Jul 2016 23:17:28 +0545 Subject: [PATCH 3/3] Whitespaces removed + Message fix * Whitespaces comprising line 200, 309 removed . * Error Message changed under _write function . --- lib/_stream_writable.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index f3c302816a252a..b102ed28fbc349 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -197,7 +197,6 @@ function validChunk(stream, state, chunk, cb) { } Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; var ret = false; @@ -306,7 +305,6 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) { stream._writev(chunk, state.onwrite); else stream._write(chunk, encoding, state.onwrite); - state.sync = false; } @@ -434,7 +432,7 @@ function clearBuffer(stream, state) { } Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('Write method cannot be invoked on the Writable stream . Method not implemented')); + cb(new Error('_write method is not implemented.')); }; Writable.prototype._writev = null;