summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/_stream_transform.js2
-rw-r--r--lib/_stream_writable.js3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js
index ba80f5c09c..b8d4a7704a 100644
--- a/lib/_stream_transform.js
+++ b/lib/_stream_transform.js
@@ -157,7 +157,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('_transform() is not implemented');
+ throw new errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_transform');
};
Transform.prototype._write = function(chunk, encoding, cb) {
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
index 7de77958d5..3ac4df7ac4 100644
--- a/lib/_stream_writable.js
+++ b/lib/_stream_writable.js
@@ -33,6 +33,7 @@ const internalUtil = require('internal/util');
const Stream = require('stream');
const Buffer = require('buffer').Buffer;
const destroyImpl = require('internal/streams/destroy');
+const errors = require('internal/errors');
util.inherits(Writable, Stream);
@@ -319,7 +320,7 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === 'string')
encoding = encoding.toLowerCase();
if (!Buffer.isEncoding(encoding))
- throw new TypeError('Unknown encoding: ' + encoding);
+ throw new errors.TypeError('ERR_UNKNOWN_ENCODING', encoding);
this._writableState.defaultEncoding = encoding;
return this;
};