mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 23:02:28 +02:00
Convert FileNotFoundCustom to named fields (#11123)
# Description Part of #10700 # User-Facing Changes None # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
This commit is contained in:
@ -563,9 +563,15 @@ fn convert_io_error(error: std::io::Error, src: PathBuf, dst: PathBuf, span: Spa
|
||||
let shell_error = match error.kind() {
|
||||
ErrorKind::NotFound => {
|
||||
if std::path::Path::new(&dst).exists() {
|
||||
ShellError::FileNotFoundCustom(message_src, span)
|
||||
ShellError::FileNotFoundCustom {
|
||||
msg: message_src,
|
||||
span,
|
||||
}
|
||||
} else {
|
||||
ShellError::FileNotFoundCustom(message_dst, span)
|
||||
ShellError::FileNotFoundCustom {
|
||||
msg: message_dst,
|
||||
span,
|
||||
}
|
||||
}
|
||||
}
|
||||
ErrorKind::PermissionDenied => match std::fs::metadata(&dst) {
|
||||
|
Reference in New Issue
Block a user