http: more descriptive setHeader errors

PR-URL: https://github.com/iojs/io.js/pull/480
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
Qasim Zaidi 2015-01-17 14:33:36 +05:30 коммит произвёл Stephen Belanger
Родитель cbc1262bd9
Коммит cf3e908b70
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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) {