Skip to content

Commit 2f05af4

Browse files
italoacasasjasnell
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 d582193 commit 2f05af4

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
@@ -453,7 +453,7 @@ function clearBuffer(stream, state) {
453453
}
454454

455455
Writable.prototype._write = function(chunk, encoding, cb) {
456-
cb(new Error('_write() method is not implemented'));
456+
cb(new Error('_write() is not implemented'));
457457
};
458458

459459
Writable.prototype._writev = null;

0 commit comments

Comments
 (0)