Permalink
Browse files

stream: improve stream error messages

Improve message when tranform._transform() method is not implemented
Improve error message when Readable._read() is not implemented
Remove extra word in err msg when Writable._write() when not implemented
Remove extra word in err msg when Transform._transform() when not implemented

PR-URL: #8801
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
  • Loading branch information...
italoacasas authored and jasnell committed Sep 27, 2016
1 parent d582193 commit 2f05af4c0634f90c2f585494651d1a35f824a0b1
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/_stream_readable.js
  2. +1 −1 lib/_stream_transform.js
  3. +1 −1 lib/_stream_writable.js
@@ -467,7 +467,7 @@ function maybeReadMore_(stream, state) {
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.
Readable.prototype._read = function(n) {
this.emit('error', new Error('not implemented'));
this.emit('error', new Error('_read() is not implemented'));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
@@ -139,7 +139,7 @@ Transform.prototype.push = function(chunk, encoding) {
// an error, then that'll put the hurt on the whole operation. If you
// never call cb(), then you'll never get another chunk.
Transform.prototype._transform = function(chunk, encoding, cb) {
throw new Error('Not implemented');
throw new Error('_transform() is not implemented');
};
Transform.prototype._write = function(chunk, encoding, cb) {
@@ -453,7 +453,7 @@ function clearBuffer(stream, state) {
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new Error('_write() method is not implemented'));
cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;

0 comments on commit 2f05af4

Please sign in to comment.