From cf3e908b70dfb345711cbca6c8e5373d085b05ea Mon Sep 17 00:00:00 2001 From: Qasim Zaidi Date: Sat, 17 Jan 2015 14:33:36 +0530 Subject: [PATCH] http: more descriptive setHeader errors PR-URL: https://github.com/iojs/io.js/pull/480 Reviewed-By: Stephen Belanger --- lib/_http_outgoing.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 40cf733225efb2..a93b7e0683c986 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -307,9 +307,9 @@ function storeHeader(self, state, field, value) { OutgoingMessage.prototype.setHeader = function(name, value) { if (typeof name !== 'string') - throw new TypeError('"name" should be a string'); + throw new TypeError('`name` should be a string in setHeader(name, value).'); if (value === undefined) - throw new Error('"name" and "value" are required for setHeader().'); + throw new Error('`value` required in setHeader("' + name + '", value).'); if (this._header) throw new Error('Can\'t set headers after they are sent.'); @@ -327,7 +327,7 @@ OutgoingMessage.prototype.setHeader = function(name, value) { OutgoingMessage.prototype.getHeader = function(name) { if (arguments.length < 1) { - throw new Error('`name` is required for getHeader().'); + throw new Error('`name` is required for getHeader(name).'); } if (!this._headers) return; @@ -339,7 +339,7 @@ OutgoingMessage.prototype.getHeader = function(name) { OutgoingMessage.prototype.removeHeader = function(name) { if (arguments.length < 1) { - throw new Error('`name` is required for removeHeader().'); + throw new Error('`name` is required for removeHeader(name).'); } if (this._header) {