Uh oh!
There was an error while loading. Please reload this page.
internal/errors: improve ERR_INVALID_ARG_TYPE - #13730
Conversation
refack
left a comment
There was a problem hiding this comment.
👍 FWIW
(need 2 CTC members' approval for semver-majors)
TimothyGu
left a comment
There was a problem hiding this comment.
+1 for semver-patch. IIRC the point of these new error objects is that changes in the error message can be done without semver-major because of the existence of code.
refack
commented
Jun 17, 2017
Anyone with more experience then me, feel free to downgrade |
There was a problem hiding this comment.
Using the word argument here was correct. Please wait for a decision to #13739, but this should not be changed.
tniessen
commented
Jun 17, 2017
Effectively blocked by #13739, see #13730 (comment) |
tniessen
left a comment
There was a problem hiding this comment.
I would like to merge #13739 in about 48 hours. In order to start CI for your PR afterwards, I need you to revert your modifications to test/parallel/test-process-hrtime.js. Take your time, there is no need to hurry (we cannot merge this before #13739 is landed and two @nodejs/ctc members still need to approve this as long as it is semver-major).
There was a problem hiding this comment.
This change should be reverted, see above.
mscdex
commented
Jun 17, 2017
@tniessen I believe we still try to give 72 hours for review during weekends instead of the 48 hours given during the week. |
tniessen
commented
Jun 17, 2017
@mscdex My bad, I scheduled it for Tuesday... You are right, that's 72 hours, not 48. |
BridgeAR
commented
Jun 20, 2017
In addition to the current change I would like to also check if the provided functiontest(opts){if(!isUint8Array(opts.prop))thrownewerrors.TypeError('ERR_INVALID_ARG_TYPE','opts.prop'['Buffer','Uint8Array'],opts.prop)}test({prop: []})// TypeError [ERR_INVALID_ARG_TYPE]: The "opts.prop" property must be instance of Buffer or Uint8Array. Received instance of Array.// instead of// TypeError [ERR_INVALID_ARG_TYPE]: The "opts.prop" property must be one of type Buffer or Uint8Array. Received type objecttest({prop: 'string'})// TypeError [ERR_INVALID_ARG_TYPE]: The "opts.prop" property must be instance of Buffer or Uint8Array. Received type string.// instead of// TypeError [ERR_INVALID_ARG_TYPE]: The "opts.prop" property must be one of type Buffer or Uint8Array. Received type stringShould I just update the PR or open another one for that? Neither the current change nor the proposed one should be semver major though as the error codes do not change and the messages are meant to change. |
jasnell
commented
Jun 20, 2017
This does not need to be semver-major. |
@BridgeAR I would prefer a separate PR to discuss such changes. Please rebase this on master and remove any modifications to |
refack
commented
Jun 20, 2017
Learned a new thing about error message semverity. |
The error message might be misleading if a object property was the issue and not the argument itself. Fix this by checking if a argument or a property is passed to the handler function.
BridgeAR
commented
Jun 20, 2017
@tniessen done |
refack
commented
Jun 20, 2017
Pre land CI: https://ci.nodejs.org/job/node-test-commit/10693/ |
The error message might be misleading if an object property was the issue and not the argument itself. Fix this by checking if a argument or a property is passed to the handler function. PR-URL: nodejs#13730 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
refack
commented
Jun 22, 2017
Landed in 3e17884 |
@jasnell Can you explain why it's not semver-major? |
jasnell
commented
Jun 22, 2017
It does not change any error types or the error code. The changes are limited to the error message and only in certain cases. Per the guidelines for the new internal/errors, changes to the message are not semver-major once the error has been migrated to use codes. |
mscdex
commented
Jun 22, 2017
@jasnell Why treat the error type specially (assuming you're referring to use of Also, I'm kind of surprised we're not giving any grace period for users to switch after the new errors system is rolled out (everywhere). |
refack
commented
Jun 22, 2017
I'm assuming since this changed only internal errors, and the change over to internal errors is |
@refack I don't understand what you mean by 'internal' errors. This PR changes error messages received by end users of node. |
refack
commented
Jun 22, 2017
The new errors that must include |
mscdex
commented
Jun 22, 2017
@refack Typically the messages aren't changed (initially) but what I said is still relevant:
|
refack
commented
Jun 23, 2017
Temporarily "don't land"ing this until |
The error message might be misleading if a object property
was the issue and not the argument itself.
Fix this by checking if a argument or a property is passed
to the handler function.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
internal/errors