-
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
url: fix error message of url.format #11162
url: fix error message of url.format #11162
Conversation
[true, 'boolean'], | ||
[false, 'boolean'], | ||
[0, 'number'], | ||
[function() {}, 'function'] |
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.
Probably add a string and a symbol.
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.
@joyeecheung Since a string is a valid input, so i just added the case of symbol :)
This is probably more a bug fix (semver-patch) than a semver-major change since the error was not there to begin with. I can't imagine many people would be checking the error message for |
6d3a48d
to
9d73e91
Compare
@mscdex I'm open to both. Added the label just to be safe. |
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.
+1 to considering this semver-patch
|
||
for (const [obj, type] of throwsObjsAndReportTypes.entries()) { | ||
const error = new RegExp('^TypeError: Parameter "urlObj" must be an object' + | ||
`, not ${type}$`); |
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.
Can you align the opening `
with the opening '
?
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.
@addaleax OK, done 👍
9d73e91
to
753c3e3
Compare
[Symbol('foo'), 'symbol'] | ||
]); | ||
|
||
for (const [obj, type] of throwsObjsAndReportTypes.entries()) { |
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: throwsObjsAndReportTypes
can be used directly instead of calling entries()
.
753c3e3
to
8772567
Compare
I'm not as certain. I think it's better to treat all of these in a consistent way. I'd argue semver-major but let's see what the rest of @nodejs/ctc has to say |
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, I'd be tempted to be conservative and treat as semver major unless we know it is causing pain to users in current versions.
I'm going to land this as a semver-major. We can back that back down after the fact if necessary. |
PR-URL: #11162 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Landed in 7818245 |
PR-URL: nodejs#11162 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
The previous code:
'Parameter "urlObj" must be an object, not ' + obj === null ? 'null' : typeof obj
actually equals('Parameter "urlObj" must be an object, not ' + obj) === null ? 'null' : typeof obj
and its former test did not check the error message.So the eventual error message we got is very weird, like:
TypeError: undefined
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
url