Skip to content
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

🙏🏻[feat/req] Need more details in error messages for thrown errors #863

Closed
rivy opened this issue Apr 17, 2021 · 3 comments · Fixed by #875
Closed

🙏🏻[feat/req] Need more details in error messages for thrown errors #863

rivy opened this issue Apr 17, 2021 · 3 comments · Fixed by #875
Labels
enhancement New feature or request

Comments

@rivy
Copy link

rivy commented Apr 17, 2021

I just ran into this error while using fs::walk()...

...
error: Uncaught NotFound: The system cannot find the path specified. (os error 3)
  for (const entry of Deno.readDirSync(root)) {
                           ^
    at unwrapOpResult (deno:core/core.js:100:13)
    at Object.opSync (deno:core/core.js:114:12)
    at Object.readDirSync (deno:runtime/js/30_fs.js:105:17)
    at walkSync (https://deno.land/std@0.92.0/fs/walk.ts:160:28)
    at walkSync.next (<anonymous>)
    at walkSync (https://deno.land/std@0.92.0/fs/walk.ts:177:14)
    at walkSync.next (<anonymous>)
    at walkSync (https://deno.land/std@0.92.0/fs/walk.ts:177:14)
    at walkSync.next (<anonymous>)
    at walkSync (https://deno.land/std@0.92.0/fs/walk.ts:177:14)
...

After some sleuthing, it turns out one of the sub-directories in the walk has disabled read permissions. But that's really impossible to determine from the information within the error object. Just adding the attempted path to the error would be have made debugging this significantly easier.

A lot of errors seem to be a blandly generic and, with an added bit more contextual information, could be of significantly more benefit to devs.

@bnoordhuis
Copy link
Contributor

I don't think Deno has access to more information than you do. That NotFound error bubbles up from the operating system, Deno just passes it on to you.

@rivy
Copy link
Author

rivy commented Apr 19, 2021

I don't think Deno has access to more information than you do. That NotFound error bubbles up from the operating system, Deno just passes it on to you.

If this was caught and re-thrown, the value of root sent to readDirSync() could be added to the exception which would be very helpful tracking down basis of the problem at issue.

@nayeemrmn
Copy link
Contributor

I think it's standard to just carry forward the OS error where applicable, the user should do that. However in this case the "user" with access to that is std -- walk() should probably indicate what path it hits an error on. This is an std issue.

@lucacasonato lucacasonato transferred this issue from denoland/deno Apr 19, 2021
@kitsonk kitsonk added the enhancement New feature or request label Apr 19, 2021
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 24, 2021
This adds the root path to error object.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 27, 2021
This adds the root path to error message.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 27, 2021
This adds the root path to error message.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
Nautigsam added a commit to Nautigsam/deno_std that referenced this issue Apr 29, 2021
This adds the root path to error message.
The `root` property is set to properly handle errors in case of
recursion.

Fix denoland#863
@kt3k kt3k closed this as completed in #875 Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants