diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-03-04 22:16:24 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-03-07 14:54:38 +0100 |
commit | 1d2fd8b65bacaf4401450edc8ed529106cbcfc67 (patch) | |
tree | dd6230e888c69ef3dc1b19de1ea8f9de7a81fd63 /lib/_stream_transform.js | |
parent | cb5f9a6d871f6b2e0da8fa72dc2e91fb37ef9713 (diff) | |
download | node-new-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.tar.gz |
lib: port remaining errors to new system
PR-URL: https://github.com/nodejs/node/pull/19137
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/_stream_transform.js')
-rw-r--r-- | lib/_stream_transform.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index b82114ecae..387a39318c 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -64,7 +64,12 @@ 'use strict'; module.exports = Transform; -const errors = require('internal/errors'); +const { + ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 +} = require('internal/errors').codes; const Duplex = require('_stream_duplex'); const util = require('util'); util.inherits(Transform, Duplex); @@ -77,7 +82,7 @@ function afterTransform(er, data) { var cb = ts.writecb; if (cb === null) { - return this.emit('error', new errors.Error('ERR_MULTIPLE_CALLBACK')); + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); } ts.writechunk = null; @@ -157,7 +162,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 errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_transform'); + throw new ERR_METHOD_NOT_IMPLEMENTED('_transform'); }; Transform.prototype._write = function(chunk, encoding, cb) { @@ -209,9 +214,9 @@ function done(stream, er, data) { // if there's nothing in the write buffer, then that means // that nothing more will ever be provided if (stream._writableState.length) - throw new errors.Error('ERR_TRANSFORM_WITH_LENGTH_0'); + throw new ERR_TRANSFORM_WITH_LENGTH_0(); if (stream._transformState.transforming) - throw new errors.Error('ERR_TRANSFORM_ALREADY_TRANSFORMING'); + throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); return stream.push(null); } |