Skip to content

Commit add1c02

Browse files
davidmarkclementsmcollina
authored andcommitted
errors: alter ERR_HTTP2_INVALID_PSEUDOHEADER
changes the base instance for ERR_HTTP2_INVALID_PSEUDOHEADER from Error to TypeError as a more accurate representation of the error. PR-URL: #19808 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent a7c25b7 commit add1c02

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/internal/errors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,10 +733,8 @@ E('ERR_HTTP2_INVALID_INFO_STATUS',
733733
'Invalid informational status code: %s', RangeError);
734734
E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH',
735735
'Packed settings length must be a multiple of six', RangeError);
736-
737-
// This should probably be a `TypeError`.
738736
E('ERR_HTTP2_INVALID_PSEUDOHEADER',
739-
'"%s" is an invalid pseudoheader or is used incorrectly', Error);
737+
'"%s" is an invalid pseudoheader or is used incorrectly', TypeError);
740738
E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error);
741739
E('ERR_HTTP2_INVALID_SETTING_VALUE',
742740
'Invalid value for setting "%s": %s', TypeError, RangeError);

test/parallel/test-http2-info-headers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function onStream(stream, headers, flags) {
3636
() => stream.additionalHeaders({ ':method': 'POST' }),
3737
{
3838
code: 'ERR_HTTP2_INVALID_PSEUDOHEADER',
39-
type: Error,
39+
type: TypeError,
4040
message: '":method" is an invalid pseudoheader or is used incorrectly'
4141
}
4242
);

test/parallel/test-http2-util-assert-valid-pseudoheader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function isNotError(val) {
1717
function isError(val) {
1818
common.expectsError({
1919
code: 'ERR_HTTP2_INVALID_PSEUDOHEADER',
20-
type: Error,
20+
type: TypeError,
2121
message: '":foo" is an invalid pseudoheader or is used incorrectly'
2222
})(val);
2323
}

0 commit comments

Comments
 (0)