errors: alter ERR_INVALID_PROTOCOL

Changes the base instance for ERR_INVALID_PROTOCOL from Error to
TypeError as a more accurate representation of the error.

PR-URL: https://github.com/nodejs/node/pull/19983
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit is contained in:
davidmarkclements 2018-04-12 20:37:11 +02:00 committed by Luigi Pinca
parent f64bebf205
commit 5c425788f1
2 changed files with 4 additions and 4 deletions

View File

@ -896,9 +896,9 @@ E('ERR_INVALID_OPT_VALUE_ENCODING',
'The value "%s" is invalid for option "encoding"', TypeError);
E('ERR_INVALID_PERFORMANCE_MARK',
'The "%s" performance mark has not been set', Error);
// This should probably be a `TypeError`.
E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', Error);
E('ERR_INVALID_PROTOCOL',
'Protocol "%s" not supported. Expected "%s"',
TypeError);
E('ERR_INVALID_REPL_EVAL_CONFIG',
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError);
E('ERR_INVALID_SYNC_FORK_INPUT',

View File

@ -38,7 +38,7 @@ invalidUrls.forEach((invalid) => {
() => { http.request(url.parse(invalid)); },
{
code: 'ERR_INVALID_PROTOCOL',
type: Error
type: TypeError
}
);
});