GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — lib: improve the usage of TypeError[INVALID_ARG_TYPE] by starkwang · Pull Request #16401 · nodejs/node Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Tempted to say that uint32 being lowercase was correct... here and in all other instances that aren't referring to Uint32Array.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@apapirovski Agreed. But most of the codes using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
393b85c to
670dab3
Compare
|
Defensively marking as semver-major... these type of changes should only need to be semver-major while we are still in the process of converting the errors over to the new mechanism. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@jasnell A lot of changes here only affect the error message. If this PR can split those changes touching error codes/adding additional throws out then IMO we could land the message-only changes as semver-patch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
@apapirovski I'd say...let's go with > util.isPrimitive(() => {}) false > util.isPrimitive({}) false |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@joyeecheung yeah, I agree — more about whether we capitalize or not. I feel like |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If this remains in some form, it should be made into a lint rule. Otherwise it should IMO be removed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you split the message-only changes into separate commits? (I guess we need to split the PR as well) That way they don't have to be semver-major.
Personally I prefer not to check the capitalizations of types in runtime, we can probably just make another eslint rule for it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since primitiveTypes is full of lowercase strings we can just do expectedType.toLowerCase()
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
primitiveTypes.includes(lowercase)?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@joyeecheung Sorry I don't understand fully. Do you mean that split every file change (about error message) into separate commits? It will be a lot of commits I guess.
Agreed. I will remove it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@starkwang Sorry for not being clear enough. Some of the changes here do not add additional throw or change the error code (i.e. do not change the first argument like "ERR_*", basically they just change the capitalization, so only the errror messages are changed), those can be split into one commit, and do not have to be sermver-major(that is, can go into 8.x). Those that do change the code or add additional throws can be split into another commit and will have to wait until 9.x |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
670dab3 to
c74148d
Compare
|
@joyeecheung I've just reduced this PR into message-only changes, which unifies the initials. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
LGTM once this changes Also I think I have incorrectly estimated the timeline in #16401 (comment) , from a quick glance I think none of the errors changed here can be backported in v8.x becuase they have not been migrated there in April anyway. The changes in this PR should be safe to land in v9.x and the other semver-major changes would probably need to wait for v10.x because we are very close to cut v9.x now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c74148d to
75e6dd5
Compare
|
Pushed commit to address comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a odd finding. We should probably do an audit on the types passed to ERR_INVALID_ARG_TYPE later...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not really need to be fixed in this PR, but this should be ['Date', 'string', 'number']
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Personally, I usually use lowercase for things which |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
75e6dd5 to
6638db6
Compare
|
@jasnell @joyeecheung @tniessen Is there anyone can review or land this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is a message-only change on the migrated errors now so we don't need TSC approvals...going to land this tomorrow if no one objects. cc @nodejs/collaborators New CI: https://ci.nodejs.org/job/node-test-pull-request/11352/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
for me, the types with actual casing that a compiler can successfully parse is one thing, and the types that a consumer can easily relate to is another thing, and it makes sense to abstract the strict syntax in human readable messages. However, consistency draws the bottom line. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The initials of expected in TypeError[ERR_INVALID_ARG_TYPE] are inconsistent. This change is to unify them. PR-URL: #16401 Fixes: #16383 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
|
Should this be backported to As this PR touches more than 50 files it may have been nice to get a backport lined up when this landed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@MylesBorins This PR cannot land in v6.x or v8.x because it changes errors that have not been migrated in either branches, see #16401 (comment) . This should be possible to be backported to v9.x though, if it actually needs a backport. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@MylesBorins Ah nevermind, I see that it's already released on v9.2.0 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Primitives should use lowercase in error message. refs: nodejs#16401
Primitives should use lowercase in error message. Refs: nodejs#16401 PR-URL: nodejs#17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Primitives should use lowercase in error message. Refs: #16401 PR-URL: #17568 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
lib: inconsistent initial ofexpected in TypeError[ERR_INVALID_ARG_TYPE]
There was an error while loading. Please reload this page.