Errors thrown by the fs API carry the same own properties as Node's, in the
same order, so code that inspects err.code, err.errno, err.syscall,
err.path or err.dest sees the same shape.
try {
fs.renameSync('/a', '/b');
} catch (err) {
err.message; // "ENOENT: no such file or directory, rename '/a' -> '/b'"
err.errno; // -2
err.code; // 'ENOENT'
err.syscall; // 'rename'
err.path; // '/a'
err.dest; // '/b'
}errnois the Linux value, negated as libuv does, on every platform. Node reports the host's value, which differs on macOS and Windows for codes such asELOOP,ENOTEMPTYandENOSYS.syscallis the libuv request name, not the JS method:readdirreportsscandir,copyFilereportscopyfile,utimesreportsutime.pathis set when the call had a path,destonly forrename,link,symlink,copyFileandcp.fs.watcherrors also carryfilename, and keep Node's key order for that call:errno,syscall,code,path,filename.
Argument validation errors (ERR_OUT_OF_RANGE, ERR_INVALID_OPT_VALUE, ...)
carry code as their only own key, no errno or syscall, as in Node. fs.rm
on a directory without recursive throws Node's SystemError with code
ERR_FS_EISDIR, a positive errno and an info object.
The ErrnoException type describing the libuv shape is exported from memfs.