-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 <anto.aravinth.cse@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Include the library-provided reason in the Error’s `message`. Fixes: #28468 PR-URL: #28487 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Include the library-provided reason in the Error’s
message
.Fixes: #28468
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes