-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
http: improve parser error messages #28487
Conversation
Include the library-provided reason in the Error’s `message`. Fixes: nodejs#28468
Fantastic! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a minor nit
const req = http.get(`http://localhost:${server.address().port}/`); | ||
req.end(); | ||
req.on('error', common.mustCall((err) => { | ||
const reason = 'Content-Length can\'t be present with chunked encoding'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: backticks instead of single quotes to avoid escaping
const reason = 'Content-Length can\'t be present with chunked encoding'; | |
const reason = `Content-Length can't be present with chunked encoding`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As note: using backticks would not be accepted by eslint. Only double quotes would be accepted. Using backticks is only accepted by eslint if the template string contains a variable.
Landed in ba565a3 |
Include the library-provided reason in the Error’s `message`. Fixes: nodejs#28468 PR-URL: nodejs#28487 Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Include the library-provided reason in the Error’s `message`. Fixes: #28468 PR-URL: #28487 Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Include the library-provided reason in the Error’s
message
.Fixes: #28468
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes