Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba46103

Browse filesBrowse files
lpincaMylesBorins
authored andcommitted
stream: fix misleading error message
The method to implement is `_write` not `_transform`. PR-URL: #18604 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 15db296 commit ba46103
Copy full SHA for ba46103

File tree

Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed
Open diff view settings
Collapse file

‎lib/_stream_writable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_writable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ function clearBuffer(stream, state) {
551551
}
552552

553553
Writable.prototype._write = function(chunk, encoding, cb) {
554-
cb(new errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_transform'));
554+
cb(new errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_write'));
555555
};
556556

557557
Writable.prototype._writev = null;
Collapse file

‎test/parallel/test-stream-writable-constructor-set-methods.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-writable-constructor-set-methods.js
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44

55
const Writable = require('stream').Writable;
@@ -26,6 +26,16 @@ w2.write(Buffer.from('blerg'));
2626
w2.write(Buffer.from('blerg'));
2727
w2.end();
2828

29+
const w3 = new Writable();
30+
31+
w3.on('error', common.expectsError({
32+
type: Error,
33+
code: 'ERR_METHOD_NOT_IMPLEMENTED',
34+
message: 'The _write method is not implemented'
35+
}));
36+
37+
w3.end(Buffer.from('blerg'));
38+
2939
process.on('exit', function() {
3040
assert.strictEqual(w._write, _write);
3141
assert(_writeCalled);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.