-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
url: show input in parse error message #11934
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
Conversation
a064947 to
790ff3e
Compare
|
Previous CI is unsuccessful. New CI: https://ci.nodejs.org/job/node-test-pull-request/6930/ |
|
+1 on this... tho I'm curious if we shouldn't also make it possible to access it programmatically. e.g. try {
new URL('test');
} catch (e) {
console.log(e.input);
}/cc @addaleax |
jasnell
left a comment
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 with green CI
TimothyGu
left a comment
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.
src/node_url.cc
Outdated
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.
I know it was there already, but using arraysize(argv) should prevent the need for a hardcoded array length.
lib/internal/url.js
Outdated
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.
Just to make sure I’m not missing something – these are dropped because the on*Complete functions are not called in the case of errors anymore, right?
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.
I'm also curious about it. Is that why the search setter doesn't need to have onParseError in this case?
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.
Yes, the completion and the errors are handled in different callbacks, since it doesn't really make sense to pass all these parsed parts to an error callback anyway.
The setters are ignoring errors per the spec at the moment, so they don't have error callbacks.
Sure, why not? Making stuff programmatically accessible is always good. |
|
Use New CI: https://ci.nodejs.org/job/node-test-pull-request/6953/ |
|
This will need a rebase |
1a863ef to
63b5a89
Compare
|
Rebased. Can anyone approved this before take a look again? Thanks! New CI: https://ci.nodejs.org/job/node-test-pull-request/6994/ |
|
Still LGTM |
PR-URL: #11934 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
|
Landed in ee19e29 |
PR-URL: #11934 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
Show the input in URL parse errors so it's easier to debug
Before
After
Also put the error handling in another callback of
binding.parse(), if it is unspecified, nothing will be done.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
url
@nodejs/url