http: improve errors thrown in header validation
Fixes: https://github.com/nodejs/node/issues/16714
This PR:
- Replace
ERR_HTTP2_INVALID_HEADER_VALUE
withERR_HTTP_INVALID_HEADER_VALUE
, don't really see a need to differentiate the two.- The error code documentation of
ERR_HTTP2_INVALID_HEADER_VALUE
is kept. - Include the header name and the value for debug-ability as https://github.com/nodejs/node/issues/16714 suggests. Before it's
Value must not be undefined or null
(HTTP2) orThe "value" argument must be specified
(HTTP), after it'sInvalid value "undefined" for header "test"
. If the user is setting the header in a loop this would be much more useful.
- The error code documentation of
- Use
Error.captureStackTrace
to exclude the validation functions from the stack trace
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
http, http2