Skip to content

Commit 926a8a6

Browse files
davidmarkclementsBridgeAR
authored andcommitted
errors: alter ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED
changes the base instance for ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED from Error to TypeError as a more accurate representation of the error.. PR-URL: nodejs#19958 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 1bf04dd commit 926a8a6

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

lib/internal/errors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,8 @@ E('ERR_HTTP2_PAYLOAD_FORBIDDEN',
596596
'Responses with %s status must not have a payload', Error);
597597
E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error);
598598
E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError);
599-
600-
// This should probably be a `TypeError`.
601599
E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
602-
'Cannot set HTTP/2 pseudo-headers', Error);
600+
'Cannot set HTTP/2 pseudo-headers', TypeError);
603601
E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error);
604602
E('ERR_HTTP2_SEND_FILE', 'Only regular files can be sent', Error);
605603
E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error);

test/parallel/test-http2-compat-serverresponse-headers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ server.listen(0, common.mustCall(function() {
7676
() => response.setHeader(header, 'foobar'),
7777
{
7878
code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
79-
type: Error,
79+
type: TypeError,
8080
message: 'Cannot set HTTP/2 pseudo-headers'
8181
})
8282
);

0 commit comments

Comments
 (0)