Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Better Errors in http validate headers #16714

Closed
bradennapier opened this issue Nov 3, 2017 · 2 comments
Closed

[REQUEST] Better Errors in http validate headers #16714

bradennapier opened this issue Nov 3, 2017 · 2 comments
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. http Issues or PRs related to the http subsystem.

Comments

@bradennapier
Copy link

bradennapier commented Nov 3, 2017

  • Version: 9.0
  • Platform: OSX

Just spent a good 2 hours trying to track down the reason for an error message. Whle the stack pointed to a nodejs source file, I wasn't sure if it was one of the packages reporting it or something else. I didn't even know where the problem was coming from:

https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L497-L508

Here it just gives this:

0|developm | 3:55:21:346 am | [SERVER] |  [ERROR] | API REQUEST | Error Caught during Request |  rJZmo6tCZ session /v2/system/session TypeError [ERR_MISSING_ARGS]: The "value" argument must be specified
0|developm |     at validateHeader (_http_outgoing.js:501:11)
0|developm |     at ClientRequest.setHeader (_http_outgoing.js:510:3)

It feels like this should actually say what the problem was rather than having to find the source code and browse through it looking for the possible reasons for things.

Maybe something like `"HTTP Header $headername is undefined."

@joyeecheung
Copy link
Member

joyeecheung commented Nov 3, 2017

In this case ERR_MISSING_ARGS does seem to be a bit too board for debug-ability, at least it should include the header name in the error message. Another search shows that the ERR_HTTP2_INVALID_HEADER_VALUE does not include the header name either. Also the validateHeader part can be eliminated with captureStacktrace.

Thanks for reporting the issue, I will open a PR shortly.

@mscdex mscdex added http Issues or PRs related to the http subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Nov 3, 2017
@bradennapier
Copy link
Author

Thank you! You guys are awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. http Issues or PRs related to the http subsystem.
Projects
None yet
3 participants