summaryrefslogtreecommitdiff
path: root/lib/_http_outgoing.js
diff options
context:
space:
mode:
authorAnton Paras <anton@paras.nu>2017-12-23 01:53:17 -0800
committerJoyee Cheung <joyeec9h3@gmail.com>2017-12-28 03:17:37 +0800
commitd3ac18a176b26c0df517f48bed77d070bb07a267 (patch)
tree48095c791638a4db48568d6e7a236e814b59f013 /lib/_http_outgoing.js
parent9f122e3b5513fd354b3876d06ea322b676b7350d (diff)
downloadandroid-node-v8-d3ac18a176b26c0df517f48bed77d070bb07a267.tar.gz
android-node-v8-d3ac18a176b26c0df517f48bed77d070bb07a267.tar.bz2
android-node-v8-d3ac18a176b26c0df517f48bed77d070bb07a267.zip
lib: migrate _http_outgoing.js's remaining errors
A couple of lib/_http_outgoing.js's errors were still in the "old style": `throw new Error(<some message here>)`. This commit migrates those 2 old style errors to the "new style": internal/errors.js's error-system. In the future, changes to these errors' messages won't break semver-major status. With the old style, changes to these errors' messages broke semver-major status. It was inconvenient. Refs: https://github.com/nodejs/node/issues/17709 PR-URL: https://github.com/nodejs/node/pull/17837 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r--lib/_http_outgoing.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 07cf84866f..324373f385 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -629,7 +629,7 @@ OutgoingMessage.prototype.write = function write(chunk, encoding, callback) {
function write_(msg, chunk, encoding, callback, fromEnd) {
if (msg.finished) {
- var err = new Error('write after end');
+ const err = new errors.Error('ERR_STREAM_WRITE_AFTER_END');
nextTick(msg.socket && msg.socket[async_id_symbol],
writeAfterEndNT.bind(msg),
err,
@@ -880,7 +880,7 @@ OutgoingMessage.prototype.flush = internalUtil.deprecate(function() {
OutgoingMessage.prototype.pipe = function pipe() {
// OutgoingMessage should be write-only. Piping from it is disabled.
- this.emit('error', new Error('Cannot pipe, not readable'));
+ this.emit('error', new errors.Error('ERR_STREAM_CANNOT_PIPE'));
};
module.exports = {