| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
👍 FWIW
(need 2 CTC members' approval for semver-majors)
Sorry, something went wrong.
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.
Sorry, something went wrong.
Anyone with more experience then me, feel free to downgrade semver level. |
Sorry, something went wrong.
There was a problem hiding this comment.
I think this is still misleading.
Sorry, something went wrong.
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.
Sorry, something went wrong.
|
Effectively blocked by #13739, see #13730 (comment) |
Sorry, something went wrong.
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).
Sorry, something went wrong.
There was a problem hiding this comment.
This change should be reverted, see above.
Sorry, something went wrong.
|
@tniessen I believe we still try to give 72 hours for review during weekends instead of the 48 hours given during the week. |
Sorry, something went wrong.
|
@mscdex My bad, I scheduled it for Tuesday... You are right, that's 72 hours, not 48. |
Sorry, something went wrong.
|
In addition to the current change I would like to also check if the provided type is actually a primitive or a class (either with a whitelist of primitives or by checking if the first letter is upper case) and change the error message accordingly. If it's a class we could write instance of instead of type of and also print the provided constructor name in case the value was provided and it is of type object. The one in "one of" could also be removed if I'm not mistaken. function test (opts) {
if (!isUint8Array(opts.prop))
throw new errors.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 object
test({ 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. |
Sorry, something went wrong.
|
This does not need to be semver-major. |
Sorry, something went wrong.
|
@BridgeAR I would prefer a separate PR to discuss such changes. Please rebase this on master and remove any modifications to test/parallel/test-process-hrtime.js (basically squash the second commit). CI won't run cleanly as it cannot automaticall merge the first commit. |
Sorry, something went wrong.
|
Learned a new thing about error message semverity. |
Sorry, something went wrong.
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.
|
Pre land CI: https://ci.nodejs.org/job/node-test-commit/10693/ |
Sorry, something went wrong.
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>
|
@jasnell Can you explain why it's not semver-major? |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
@jasnell Why treat the error type specially (assuming you're referring to use of Error, TypeError, RangeError, etc.) and not the message? I would think users could be explicitly checking both? 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). |
Sorry, something went wrong.
I'm assuming since this changed only internal errors, and the change over to internal errors is semver-major the impact is mitigated. |
Sorry, something went wrong.
@refack I don't understand what you mean by 'internal' errors. This PR changes error messages received by end users of node. |
Sorry, something went wrong.
The new errors that must include .code as tracked by #11273. Those errors' messages were already changed in a semver-major way. |
Sorry, something went wrong.
|
@refack Typically the messages aren't changed (initially) but what I said is still relevant:
|
Sorry, something went wrong.
|
Temporarily "don't land"ing this until semverity is decided. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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
Affected core subsystem(s)
internal/errors