diff options
author | davidmarkclements <huperekchuno@googlemail.com> | 2018-04-04 20:29:52 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2018-04-09 13:05:35 +0200 |
commit | add1c02bda14be1e00f92ef1e7b2c155abaeeeae (patch) | |
tree | ae691497e32833cd5bb6170123dac889c34c21fc | |
parent | a7c25b7d42b79878548b9d660af0195e7318fc33 (diff) | |
download | node-new-add1c02bda14be1e00f92ef1e7b2c155abaeeeae.tar.gz |
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: https://github.com/nodejs/node/pull/19808
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
-rw-r--r-- | lib/internal/errors.js | 4 | ||||
-rw-r--r-- | test/parallel/test-http2-info-headers.js | 2 | ||||
-rw-r--r-- | test/parallel/test-http2-util-assert-valid-pseudoheader.js | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 570e8d811e..f7c444afb2 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -733,10 +733,8 @@ E('ERR_HTTP2_INVALID_INFO_STATUS', 'Invalid informational status code: %s', RangeError); E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', 'Packed settings length must be a multiple of six', RangeError); - -// This should probably be a `TypeError`. E('ERR_HTTP2_INVALID_PSEUDOHEADER', - '"%s" is an invalid pseudoheader or is used incorrectly', Error); + '"%s" is an invalid pseudoheader or is used incorrectly', TypeError); E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error); E('ERR_HTTP2_INVALID_SETTING_VALUE', 'Invalid value for setting "%s": %s', TypeError, RangeError); diff --git a/test/parallel/test-http2-info-headers.js b/test/parallel/test-http2-info-headers.js index 2313040de1..132818c409 100644 --- a/test/parallel/test-http2-info-headers.js +++ b/test/parallel/test-http2-info-headers.js @@ -36,7 +36,7 @@ function onStream(stream, headers, flags) { () => stream.additionalHeaders({ ':method': 'POST' }), { code: 'ERR_HTTP2_INVALID_PSEUDOHEADER', - type: Error, + type: TypeError, message: '":method" is an invalid pseudoheader or is used incorrectly' } ); diff --git a/test/parallel/test-http2-util-assert-valid-pseudoheader.js b/test/parallel/test-http2-util-assert-valid-pseudoheader.js index 27050fedd6..badd7442ad 100644 --- a/test/parallel/test-http2-util-assert-valid-pseudoheader.js +++ b/test/parallel/test-http2-util-assert-valid-pseudoheader.js @@ -17,7 +17,7 @@ function isNotError(val) { function isError(val) { common.expectsError({ code: 'ERR_HTTP2_INVALID_PSEUDOHEADER', - type: Error, + type: TypeError, message: '":foo" is an invalid pseudoheader or is used incorrectly' })(val); } |