Skip to content

fs: simplify the error context collection in C++, migrate fs.close errors

fs: simplify the error context collection in C++

  • Simplify the SyncCall template function, only collect error number and syscall in the C++ layer and collect the rest of context in JS for flexibility.
  • Remove the stringFromPath JS helper now that the unprefixed path is directly put into the context before the binding is invoked with the prefixed path.
  • Add a errno -> [error code, uv error message] map to the uv binding so the error message can be assembled in the JS layer

fs: throw fs.close errors in JS

  • Check fd in JS before invoking the binding and throw ERR_INVALID_ARG_TYPE if it's not an integer
  • Add a test for checking the errors thrown from fs.close and fs.closeSync
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

fs, test, errors

Merge request reports

Loading