mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Convert more ShellError variants to named fields (#11173)
# Description Convert these ShellError variants to named fields: * CreateNotPossible * MoveNotPossibleSingle * DirectoryNotFoundCustom * DirectoryNotFound * NotADirectory * OutOfMemoryError * PermissionDeniedError * IOErrorSpanned * IOError * IOInterrupted Also place the `span` field of `DirectoryNotFound` last to match other errors. Part of #10700 (almost half done!) # User-Facing Changes None # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
This commit is contained in:
@ -36,7 +36,10 @@ impl Command for Clear {
|
||||
CommandSys::new("cmd")
|
||||
.args(["/C", "cls"])
|
||||
.status()
|
||||
.map_err(|e| ShellError::IOErrorSpanned(e.to_string(), span))?;
|
||||
.map_err(|e| ShellError::IOErrorSpanned {
|
||||
msg: e.to_string(),
|
||||
span,
|
||||
})?;
|
||||
} else if cfg!(unix) {
|
||||
let mut cmd = CommandSys::new("/bin/sh");
|
||||
|
||||
@ -46,7 +49,10 @@ impl Command for Clear {
|
||||
|
||||
cmd.args(["-c", "clear"])
|
||||
.status()
|
||||
.map_err(|e| ShellError::IOErrorSpanned(e.to_string(), span))?;
|
||||
.map_err(|e| ShellError::IOErrorSpanned {
|
||||
msg: e.to_string(),
|
||||
span,
|
||||
})?;
|
||||
}
|
||||
|
||||
Ok(Value::nothing(span).into_pipeline_data())
|
||||
|
Reference in New Issue
Block a user