fs: do not pass Buffer when toString() fails
Checklist
-
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
- fs
Description of change
Even though an Error object is passed to the callback when readFile()
fails due to toString()
failing, it is a bit strange to still see data passed as the second argument. This commit changes that and only
passes the Error object in that case.