Skip to content

Commit 560a589

Browse files
italoacasasimyller
authored andcommitted
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
1 parent 33dd4ec commit 560a589

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/_stream_readable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ function maybeReadMore_(stream, state) {
467467
// for virtual (non-string, non-buffer) streams, "length" is somewhat
468468
// arbitrary, and perhaps not very meaningful.
469469
Readable.prototype._read = function(n) {
470-
this.emit('error', new Error('not implemented'));
470+
this.emit('error', new Error('_read() is not implemented'));
471471
};
472472

473473
Readable.prototype.pipe = function(dest, pipeOpts) {

lib/_stream_transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Transform.prototype.push = function(chunk, encoding) {
139139
// an error, then that'll put the hurt on the whole operation. If you
140140
// never call cb(), then you'll never get another chunk.
141141
Transform.prototype._transform = function(chunk, encoding, cb) {
142-
throw new Error('Not implemented');
142+
throw new Error('_transform() is not implemented');
143143
};
144144

145145
Transform.prototype._write = function(chunk, encoding, cb) {

lib/_stream_writable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ function clearBuffer(stream, state) {
432432
}
433433

434434
Writable.prototype._write = function(chunk, encoding, cb) {
435-
cb(new Error('_write() method is not implemented'));
435+
cb(new Error('_write() is not implemented'));
436436
};
437437

438438
Writable.prototype._writev = null;

0 commit comments

Comments
 (0)