-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node-compa: better error message #25921
Comments
I think there is some error wrapping going on here that needs to just be removed from the |
Do you think adding the missing file path information is sufficient for this case. If so, i can make a PR. @lucacasonato |
It is my first time to contribute to deno. So i follow the instruction in here. After everything set up, run deno/ext/node/polyfills/_fs/_fs_stat.ts Line 420 in f5caf9d
|
By using local version of rusty_v8 precompile, deno was built successfully. deno/ext/node/polyfills/_fs/_fs_stat.ts Line 420 in f5caf9d
Change it to: throw denoErrorToNodeError(err, { syscall: "stat", path: path.toString() }); Below is the test code: import fs from "node:fs";
function readFileWithNode(file: string | URL) {
const type = typeof file === "string" ? "string" : "url";
try {
fs.statSync(file);
} catch (error: unknown) {
console.log(
`Error occurred while reading ${type} file with node: ${error}`,
);
}
}
function readFileWithDeno(file: string | URL) {
const type = typeof file === "string" ? "string" : "url";
try {
Deno.statSync(file);
} catch (error: unknown) {
console.log(
`Error occurred while reading ${type} file with deno: ${error}`,
);
}
}
const file = "non-exist-file";
const fileUrl = new URL(file, import.meta.url);
readFileWithNode(file);
readFileWithDeno(file);
readFileWithNode(fileUrl);
readFileWithDeno(fileUrl); Output is:
Do you think it is ok? |
Version: Deno 1.46.1
Run below command:
The output is:
In this case, better error message(has path information) is useful for debug.
The text was updated successfully, but these errors were encountered: