Map DirectoryNotFound to FileNotFound for open command (issue #10085)#10089
Map DirectoryNotFound to FileNotFound for open command (issue #10085)#10089sholderbach merged 1 commit intonushell:mainfrom
DirectoryNotFound to FileNotFound for open command (issue #10085)#10089Conversation
FileNotFound error instead of DirectoryNotFound error for open command (issue #10085)DirectoryNotFound for FileNotFound for open command (issue #10085)
amtoine
left a comment
There was a problem hiding this comment.
i've been able to see that this PR fixes the unhelpful error 👌
could we have a little test to make sure that open euwiqoeu gives a file not found error? 😋
Looked into the tests and found one that was already testing this functionality, updated to check I'm new to Rust, is there a way to capture the actual error instead and assert it is of type Let me know if that fulfills the requirements you expect. |
|
because ~ INSERT > open i_dont_exist.txt
Error: nu::shell::directory_not_found
× Directory not found
╭─[entry #1:1:1]
1 │ open i_dont_exist.txt
· ────────┬───────
· ╰── directory not found
╰────should have |
not sure at all in that case 🤔
|
|
@amtoine OOI what's the process for getting this reviewed and merged in? Is it done on a schedule or quite ad-hoc? |
there's no schedule to land PRs, only to release Nushell every 4 weeks 😋 this PR touches parts of the source base i'm not familiar with, so it might need another quick look from another member of the core team, but other than that, it looks it's in a good shape to land soon 😌 |
|
@GPadley I think we're ready to land this if you can resolve the conflicts. Thanks! |
|
Apologies for the delay - have fixed merge conflicts with main so should be ready to go once all check are passed. |
b159668 to
74a810f
Compare
|
After reviewing this again, it looks like we have 13 places where I'm not sure it's worth all these changes just to have it used in 1 place. What do others think? |
sounds sensible to me to say "file or directory", this is what Bash is doing and it does the job, in the end, files and directories are mostly the same thing in the file system 😋 $ ls euqwio
ls: cannot access 'euqwio': No such file or directory$ cd ewuqi
bash: cd: ewuqi: No such file or directory |
|
So there are a couple ways I could do this:
|
sholderbach
left a comment
There was a problem hiding this comment.
I am neither a fan of degrading the error message quality nor bloating the ShellError with rarely used variants, people will almost certainly pick the wrong one in the future.
74a810f to
b1109c3
Compare
DirectoryNotFound for FileNotFound for open command (issue #10085)DirectoryNotFound to FileNotFound for open command (issue #10085)
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for making this error nicer for the users and iterating on this with us! Let's go!
|
@GPadley thank you! I had reported the linked issue, and its cool you fixed it :) |
…#10089) # Description This PR should close nushell#10085 Maps `DirectoryNotFound` errors to `FileNotFound`. All other errors are left unchanged. # User-Facing Changes This means a user will see `FileNotFound` instead of `DirectoryNotFound` which is more meaning full to the user.
Description
This PR should close #10085
Maps
DirectoryNotFounderrors toFileNotFound. All other errors are left unchanged.User-Facing Changes
This means a user will see
FileNotFoundinstead ofDirectoryNotFoundwhich is more meaning full to the user.Tests + Formatting
After Submitting