errors, path: migrate to use internal/errors.js#11319
errors, path: migrate to use internal/errors.js#11319seppevs wants to merge 1 commit intonodejs:masterfrom
Conversation
lib/path.js
Outdated
There was a problem hiding this comment.
Why typeof path is not passed?
There was a problem hiding this comment.
The typeof path was not passed before the change. The inspect(path) returned the value, this is not something the ERR_INVALID_ARG_TYPE supports.
|
Related: #11308 also has an implementation for |
|
@thefourtheye : yes, it's the same implementation. Just like in #11300 |
967737a to
9fa0056
Compare
|
I've just rebased this. |
lib/path.js
Outdated
There was a problem hiding this comment.
hmm... I'm thinking string (lowercase) would be better on these.
9fa0056 to
a567257
Compare
There was a problem hiding this comment.
Need to gourd against changes in messages https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#breaking-changes
| assert.throws(function() { | ||
| fs.watchFile(new Object(), common.noop); | ||
| }, /Path must be a string/); | ||
| }, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); |
There was a problem hiding this comment.
Could you add an assertion on the message as well?
(Changing the message is semver-major so let's enforce it)
There was a problem hiding this comment.
This is a semver-major change, so it's totally fine to change the message.
There was a problem hiding this comment.
Yes, but let's keep it from regressing.
| const expectedMessage = common.expectsError({ | ||
| code: 'ERR_INVALID_ARG_TYPE', | ||
| type: TypeError | ||
| }); |
There was a problem hiding this comment.
ditto.
(You can turn this into a Factory that takes the messages)
| assert.throws(() => { | ||
| fn.apply(null, args); | ||
| }, TypeError); | ||
| }, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); |
|
CI failures are infrastructure related. |
| {method: 'format', input: [null], message: expectedMessage}, | ||
| {method: 'format', input: [''], message: expectedMessage}, | ||
| {method: 'format', input: [true], message: expectedMessage}, | ||
| {method: 'format', input: [1], message: expectedMessage}, |
There was a problem hiding this comment.
We'll need to agree on whether the tests should check the contents of the message or not, but since have landed tests both with and without, I'm fine with landing as is.
|
@refack I can't quite tell from the comments/discussion if your suggestions have been addressed and you are ok with this landing. It looks like the CI is good and it may be ready to go but I'd like to be sure. Since the CI is also 2 weeks old we probably want to run a new one. |
@mhdawson Like you said, not worth blocking for full message validation. |
|
@refack thanks for the quick response. I'll open an issue where we can discuss what we think is the right way to go on the messages and then we can do a second pass to fix up based on what we decide. New CI run: https://ci.nodejs.org/job/node-test-pull-request/8517/ |
|
OSX CI failure looks unrelated. Opened this issue to track: #13507 |
|
CI good so landing. |
|
Landed as dcfbbac |
Migrate path.js to use internal/errors.js.
Refs: #11273
cc @jasnell
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
errors,path