bun icon indicating copy to clipboard operation
bun copied to clipboard

[fs] `path` is missed in `Error` object

Open AlttiRi opened this issue 5 months ago • 1 comments

What version of Bun is running?

1.0.23

What platform is your computer?

Window 10

What steps can reproduce the bug?

import fs from "node:fs/promises";

try {
    await fs.stat("c:/qwerty123");
} catch (e) {
    console.error(e);
    console.error(e.message);
    console.error(e.errno);
    console.error(e.code);
    console.error(e.syscall);
    console.error(e.path);
}

What is the expected behavior?

Node.js:

[Error: ENOENT: no such file or directory, stat 'c:\qwerty123'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'c:\\qwerty123'
}
ENOENT: no such file or directory, stat 'c:\qwerty123'
-4058
ENOENT
stat
c:\qwerty123

What do you see instead?

Bun:

ENOENT: No such file or directory
   errno: -4058
 syscall: "stat"


No such file or directory
-4058
ENOENT
stat
undefined

Additional information

path property is really useful in IO errors. However, it's undefined in Bun, while it is present in Node.js.

AlttiRi avatar Jan 18 '24 06:01 AlttiRi

Updating tags and issue description as this is more than just Windows. It's just a feature gap.

jdalton avatar Jan 22 '24 23:01 jdalton