fs: throw errors on invalid paths synchronously
Since type check errors on paths are throw synchronously, it makes more sense to throw other types of checks on the paths synchronously as well.
fs: throw errors on invalid paths synchronously
- Throw getPathFromURL() and nullCheck() errors synchronously instead of deferring them to the next tick, since we already throw validatePath() errors synchronously.
- Merge nullCheck() into validatePath()
- Never throws in
fs.exists()
, instead, invoke the callback with false, or emit a warning when the callback is not a function. This is to bring it inline with fs.existsSync(), which never throws. - Updates the comment of rethrow()
- Throw ERR_INVALID_ARG_VALUE for null checks
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
fs, whatwg-url