Skip to content

Commit eca95a9

Browse files
davidmarkclementsjasnell
authored andcommitted
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: #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>
1 parent a5cf3fe commit eca95a9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/errors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,9 @@ E('ERR_INVALID_OPT_VALUE_ENCODING',
896896
'The value "%s" is invalid for option "encoding"', TypeError);
897897
E('ERR_INVALID_PERFORMANCE_MARK',
898898
'The "%s" performance mark has not been set', Error);
899-
900-
// This should probably be a `TypeError`.
901-
E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', Error);
899+
E('ERR_INVALID_PROTOCOL',
900+
'Protocol "%s" not supported. Expected "%s"',
901+
TypeError);
902902
E('ERR_INVALID_REPL_EVAL_CONFIG',
903903
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError);
904904
E('ERR_INVALID_SYNC_FORK_INPUT',

test/parallel/test-http-url.parse-only-support-http-https-protocol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ invalidUrls.forEach((invalid) => {
3838
() => { http.request(url.parse(invalid)); },
3939
{
4040
code: 'ERR_INVALID_PROTOCOL',
41-
type: Error
41+
type: TypeError
4242
}
4343
);
4444
});

0 commit comments

Comments
 (0)