From d2913384aaeaf08fddb52e25e01f84c62e96e240 Mon Sep 17 00:00:00 2001 From: LAKSHMI SWETHA GOPIREDDY Date: Mon, 5 Jun 2017 02:54:02 -0400 Subject: [PATCH] errors,stream_wrap: use internal/errors.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/13291 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson --- lib/_stream_wrap.js | 3 ++- lib/internal/errors.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/_stream_wrap.js b/lib/_stream_wrap.js index 25a77b8c4a9e8c..4b92fb64536b11 100644 --- a/lib/_stream_wrap.js +++ b/lib/_stream_wrap.js @@ -9,6 +9,7 @@ const JSStream = process.binding('js_stream').JSStream; var Buffer = require('buffer').Buffer; const uv = process.binding('uv'); const debug = util.debuglog('stream_wrap'); +const errors = require('internal/errors'); function StreamWrap(stream) { const handle = new JSStream(); @@ -51,7 +52,7 @@ function StreamWrap(stream) { this.pause(); this.removeListener('data', ondata); - self.emit('error', new Error('Stream has StringDecoder')); + self.emit('error', new errors.Error('ERR_STREAM_HAS_STRINGDECODER')); return; } diff --git a/lib/internal/errors.js b/lib/internal/errors.js index fcfbdd24bf3925..a73d4599313b09 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -158,6 +158,7 @@ E('ERR_PARSE_HISTORY_DATA', E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support'); E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed'); E('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed'); +E('ERR_STREAM_HAS_STRINGDECODER', 'Stream has StringDecoder'); E('ERR_TRANSFORM_ALREADY_TRANSFORMING', 'Calling transform done when still transforming'); E('ERR_TRANSFORM_MULTIPLE_CALLBACK', 'Callback called multiple times');