Skip to content

fs: do not pass Buffer when toString() fails

Checklist
  • make -j8 test (UNIX), or vcbuild 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.

CI: https://ci.nodejs.org/job/node-test-pull-request/4877/

Merge request reports

Loading