| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
I suspect this principle has been decided previously, but maybe not?:
Is it desirable to have such specific codes? Why not just ERR_INVALID_ARG_VALUE?
Sorry, something went wrong.
There was a problem hiding this comment.
it's been debated and I'm good with it either way.
Sorry, something went wrong.
There was a problem hiding this comment.
I'd be in favor of erring on the side of more general and you can always move to a more specific code later if it turns out it's really needed. But yeah, if there's fierce opinions on both sides, then ¯\(ツ)/¯
Sorry, something went wrong.
There was a problem hiding this comment.
ERR_OUT_OF_RANGE is reduced into ERR_VALUE_OUT_OF_RANGE in #17648. So here would be better to use ERR_VALUE_OUT_OF_RANGE.
Sorry, something went wrong.
There was a problem hiding this comment.
+1
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell ^
Sorry, something went wrong.
There was a problem hiding this comment.
yep, was holding off a bit to see if/when #17648 was going to land.
Sorry, something went wrong.
There was a problem hiding this comment.
oh.. right, and the latest updates remove the out of range errors anyway so this is no longer relevant ;-)
Sorry, something went wrong.
There was a problem hiding this comment.
It would justify this new error a bit more if the error message includes a list of valid symlink types
Sorry, something went wrong.
|
ping @nodejs/tsc |
Sorry, something went wrong.
|
Chose to go with @joyeecheung's suggestion of a more specific error message. PTAL |
Sorry, something went wrong.
Sorry, something went wrong.
|
Thank you @joyeecheung :-) ... @nodejs/tsc ... need one more TSC sign off please. |
Sorry, something went wrong.
|
Looks like there was something wrong with linux one, new linux one CI: https://ci.nodejs.org/job/node-test-commit-linuxone/11371/ |
Sorry, something went wrong.
| throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', | ||
| ['string', 'Buffer', 'URL']); | ||
| } | ||
| if (!Number.isInteger(uid)) |
There was a problem hiding this comment.
Should we also check for uid >= 0? Same question for the other checks in this commit
Sorry, something went wrong.
There was a problem hiding this comment.
I do believe that uid and gid both can be negative in some edge cases.
Sorry, something went wrong.
|
|
||
| var req = new FSReqWrap(); | ||
| if (!Number.isInteger(fd)) | ||
| throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'fd', 'number'); |
There was a problem hiding this comment.
s/number/integer/
Sorry, something went wrong.
| // fs.writeSync(fd, string[, position[, encoding]]); | ||
| fs.writeSync = function(fd, buffer, offset, length, position) { | ||
| if (!Number.isInteger(fd)) | ||
| throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'fd', 'number'); |
There was a problem hiding this comment.
s/number/integer/
Sorry, something went wrong.
There was a problem hiding this comment.
+1
Sorry, something went wrong.
| [`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE | ||
| [`EventEmitter`]: events.html#events_class_eventemitter | ||
| [`fs.symlink()`]: fs.html#fs_symlink | ||
| [`fs.symlinkSync()`]: fs.html#fs_symlinksymc |
There was a problem hiding this comment.
typo: symlinksync
Sorry, something went wrong.
|
General question about Number.isInteger checks: the check passes for values > 2^31-1 in JS land but not in C++ land. Should we guard for this? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with the nits already noted addresses
Sorry, something went wrong.
Replacing IsInt32() and IsUint32() checks with Number.isInteger() is wrong. Their JS equivalents are x === x | 0 and x === x >>> 0 respectively. Another issue with Number.isInteger() is that users can monkey-patch it. |
Sorry, something went wrong.
|
Updated to address @bnoordhuis' feedback. @mcollina and @joyeecheung ... please take another look. |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with the nit above adressed.
Sorry, something went wrong.
There was a problem hiding this comment.
IsInt32 (both lines)
Sorry, something went wrong.
There was a problem hiding this comment.
FChown is not changed in this PR and also gets Uint32Value(). Are you sure negative uid and gid are possible?
Sorry, something went wrong.
There was a problem hiding this comment.
hmm... they are definitely theoretically possible but you're right. I'll keep these as uint32s
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #17667 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
There was a problem hiding this comment.
Belated LGTM
Sorry, something went wrong.
|
@jasnell it looks like the new assertions in src/node_file.cc are causing some CitGM issues. Would you mind having a look? https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1165/ |
Sorry, something went wrong.
|
@apapirovski The CITGM issues are caused by fs.readFile and fs.exists/fs.existsSync raising assertion when the path is undefined. I have a fix coming up. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Next batch of fs type checking migrations to use internal/errors
Checklist
Affected core subsystem(s)
fs