mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
More precise ErrorKind::NotFound
errors (#15149)
In this PR, the two new variants for `ErrorKind`, `FileNotFound` and `DirectoryNotFound` with a nice `not_found_as` method for the `ErrorKind` to easily specify the `NotFound` errors. I also updated some places where I could of think of with these new variants and the message for `NotFound` is no longer "Entity not found" but "Not found" to be less strange. closes #15142 closes #15055
This commit is contained in:
@ -210,7 +210,7 @@ fn filesystem_directory_not_found() {
|
||||
actual.err
|
||||
);
|
||||
assert!(
|
||||
actual.err.contains("nu::shell::io::not_found"),
|
||||
actual.err.contains("nu::shell::io::directory_not_found"),
|
||||
"actual={:?}",
|
||||
actual.err
|
||||
);
|
||||
|
@ -172,7 +172,7 @@ fn file_not_exist() {
|
||||
"
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("nu::shell::io::not_found"));
|
||||
assert!(actual.err.contains("nu::shell::io::file_not_found"));
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ fn errors_if_file_not_found() {
|
||||
// This seems to be not directly affected by localization compared to the OS
|
||||
// provided error message
|
||||
|
||||
assert!(actual.err.contains("nu::shell::io::not_found"));
|
||||
assert!(actual.err.contains("nu::shell::io::file_not_found"));
|
||||
assert!(actual.err.contains(
|
||||
&PathBuf::from_iter(["tests", "fixtures", "formats", "i_dont_exist.txt"])
|
||||
.display()
|
||||
|
Reference in New Issue
Block a user