| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Maybe the error message was referring to the urlObject in the documentation but that is still inconsistent. |
Sorry, something went wrong.
There was a problem hiding this comment.
I think the error message is correct as is. It's referring to the urlObj parameter of url.format(). If anything, it should be changed to say that it needs to be a string or an object, rather than just an object. And maybe a comment could be added to the code explaining why it says urlObj rather than obj. https://nodejs.org/api/url.html#url_url_format_urlobject
Sorry, something went wrong.
Another possibility is to update the code itself so that the function signature is urlObj rather than obj so the error message is correct. I'm less enthusiastic about changing the documentation to say obj because it can be a string too. urlObj is misleading enough. :-D |
Sorry, something went wrong.
|
The existing comments in that function are confusing (to me, at least0, so there's an opportunity there too... |
Sorry, something went wrong.
|
PR updated with urlObject parameter name and rebased with master, now there is no conflicts) Guys, looks like there is another inconsistence here: The function that we are changing: function urlFormat(obj, options) { from the actual code is exported here as: module.exports = {
...
// Original API
format: urlFormat
...
}
According with latest and LTS docs, the signature of this method is url.format(urlObject) ... so, other than the wrong parameter name in the actual code (obj) and the wrong name in the error message (urlObj) a new options parameter as been introduced in the actual code and is not documented. This is a legacy API, should not add new parameters. PS: To make things more confusing: from the v6.2.1 docs onwards, the signature was changed to the actual url.format(urlObject) ... you can check previous docs, like v6.2.0 and see that the signature was url.format(urlObj) :-0
|
Sorry, something went wrong.
|
@leggiero The additional parameter was added by @jasnell in c5e9654. Documentation was added in 0d9ea4f. Those commits first appeared in 8.0.0. The options object is not in any LTS releases at this time and is documented in the (non-LTS) releases where it is. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM if CI is green.
Sorry, something went wrong.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/8936/ Thanks for the contribution! 🎉 |
Sorry, something went wrong.
|
There's currently discussion as to whether or not message text changes to these newer types of errors are considered breaking changes or not. I have no strong opinion about that, but am marking this semver-major defensively until that question is resolved (hopefully later this week). (@cjihrig had already marked it semver-major but I removed it in error, so now I'm adding it back with an explanation.) |
Sorry, something went wrong.
|
@leggiero CI is reporting one or more lint errors. Can you run make jslint (or vcbuild jslint if on Windows) and see what if you can sort out what the problem is? From a quick look, it looks like you might have a line longer than 80 characters. |
Sorry, something went wrong.
|
@Trott lint error solved. PS: would be nice to add the make jslint checklist entry in template PR message. |
Sorry, something went wrong.
|
@leggiero make jslint is (or should be) implied in the make test command. |
Sorry, something went wrong.
If you run make test as described in the PR template message, it runs make lint after the tests pass. (It won't bother if tests fail.) make lint runs both the JS linter and the C++ linter. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Landed in 8520e6f. |
Sorry, something went wrong.
Documentation, error message, and code now use the same argument name. PR-URL: #14031 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| Back | FazBrowse Home | New Git URL |
Fixed typo in error message to output the right parameter name url instead of objUrl.
Checklist
Affected core subsystem(s)
lib