mirror of
https://github.com/nushell/nushell.git
synced 2025-07-07 18:07:02 +02:00
Map DirectoryNotFound
to FileNotFound
for open
command (#10089)
# Description This PR should close #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.
This commit is contained in:
@ -103,7 +103,13 @@ impl Command for Open {
|
||||
let arg_span = path.span;
|
||||
// let path_no_whitespace = &path.item.trim_end_matches(|x| matches!(x, '\x09'..='\x0d'));
|
||||
|
||||
for path in nu_engine::glob_from(&path, &cwd, call_span, None)?.1 {
|
||||
for path in nu_engine::glob_from(&path, &cwd, call_span, None)
|
||||
.map_err(|err| match err {
|
||||
ShellError::DirectoryNotFound(span, _) => ShellError::FileNotFound(span),
|
||||
_ => err,
|
||||
})?
|
||||
.1
|
||||
{
|
||||
let path = path?;
|
||||
let path = Path::new(&path);
|
||||
|
||||
|
Reference in New Issue
Block a user