-
Notifications
You must be signed in to change notification settings - Fork 623
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
fix(fs): no root path in walk error #875
Conversation
I think we should show the path in error message because otherwise it doesn't show up when the user didn't catch it. I also think we should show the full path which caused the error, instead of the root path. |
8652492
to
c285075
Compare
@kt3k I put the path in the error message.
Do you mean if the root path is a relative path we should make it absolute by joining it with Deno.cwd() ? |
@Nautigsam I think that's possible by moving the try-catch clause to nearer place to the actual fs API calls. |
@kt3k I don't think it is possible. The error is fired by |
@Nautigsam Ok. Let's show let files
try {
files = Deno.readDir(root);
} catch (e) {
throw new Error("Couldn't read...");
}
for await (const entry of files) { ... } |
Ok I'll do it. One last question: I don't know if there is some kind of convention about composing error messages? I chose to make it more natural by appending
We could as well put it at the start but it feels more robotic when it's thrown:
|
Ah, I missed your latest update. The error message now looks good to me! |
c285075
to
faa3602
Compare
I could narrow the try-catch arount readDirSync but not readDir. Since it returns an AsyncIterable, the error is thrown by the for await..of. If you think it's okay then I'm done. |
9740193
to
a48efae
Compare
This adds the root path to error message. The `root` property is set to properly handle errors in case of recursion. Fix denoland#863
a48efae
to
767d0ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nautigsam LGTM. Thank you for your contribution!
This adds the root path to error object. I am not sure this is the way to go, maybe I should put it in the message?
Fix #863