pub enum CmdError {
SystemError(String, Error),
NonZeroExitNotStreamed(NamedOutput),
NonZeroExitAlreadyStreamed(NamedOutput),
}Expand description
Who says (Command) errors can’t be fun?
Fun run errors include all the info a user needs to debug, like the name of the command that failed and any outputs (like error messages in stderr).
Fun run errors don’t overwhelm end users, so by default if stderr is already streamed the output won’t be duplicated.
Enjoy if you want, skip if you don’t. Fun run errors are not mandatory.
Error output formatting is unstable
Variants§
SystemError(String, Error)
NonZeroExitNotStreamed(NamedOutput)
NonZeroExitAlreadyStreamed(NamedOutput)
Implementations§
source§impl CmdError
impl CmdError
sourcepub fn name(&self) -> Cow<'_, str>
pub fn name(&self) -> Cow<'_, str>
Returns a display representation of the command that failed
Example:
use fun_run::CommandWithName;
use std::process::Command;
let result = Command::new("cat")
.arg("mouse.txt")
.named_output();
match result {
Ok(_) => unimplemented!(),
Err(error) => assert_eq!(error.name().to_string(), "cat mouse.txt")
}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CmdError
impl Send for CmdError
impl Sync for CmdError
impl Unpin for CmdError
impl !UnwindSafe for CmdError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more