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 — errors: improve invalid arg type by BridgeAR · Pull Request #13834 · nodejs/node Conversation
Member
I reworked the There is one point that might be thought about: mixing multiple expected values can only print either Checklist
Affected core subsystem(s)errors
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mscdex
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to use single equals to also check for
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, as far as I can tell someone would have to explicitly set the constructor to null... that would be really weird but I'll change it accordingly.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@BridgeAR Right, that's the end goal, but I think until the new error mechanism is widely adopted (e.g. users start checking the special error properties instead of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Like the improvement. Agree we should still be making these changes semver-major until we get overall agreement that we can starting treating error messages changes differently. Also needs a rebase. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There are mixed messages being conveyed #13730 (comment)... IMHO the CTC should discuss and decide. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c180fec to
63c5700
Compare
|
Rebased |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
IMHO in the tests when you assert the message it should be a RegEx anchored with start-of-line and end in "Received": |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Another idea: export a function from errors: function invalidArg(opts) { assert.strictEqual(Object.keys(opts).length, 2); assert.strictEqual('expected' in opts, true); const exp = opts.expected; delete opts.expected; const actKey = Object.keys(opts)[0]; const actVal = opts[actKey]; throw new TypeError('ERR_INVALID_ARG_TYPE', actKey, exp, actVal // if we add a stackLimit arg // ,invalidArg); } |
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.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you anchor these /^...
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.
Addressed
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.
IMHO for readability use undefined
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.
I personally prefer it this way to have a consistent way of doing this but I don't have strong feelings about 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.
👍 Generally I yield to the OP. So it's your call.
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.
Personal style nit: Is these cases chop down the args like in L1082
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.
Addressed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
63c5700 to
0d4204c
Compare
I feel like this is a bit to much magic and the call itself won't be much shorter. So I'd say let's stick to how it is currently. I also added the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
👍
Just so it doesn't change "accidentally". Changes in test files get more review attention, so IMHO it's best to assert as much as possible, then later change carefully. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sanity: https://ci.nodejs.org/job/node-test-commit-linuxone/6883/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0d4204c to
dc4e540
Compare
|
Rebased |
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 question. In a number of tests the check stops at 'Received' any reason we can't validate the additional information after 'Received' as well ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It is in most cases possible to use the exact value. In the end I don't think that it's that important to test for the message strictly as it can change more often but I'm fine with changing it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.