#[non_exhaustive]pub enum RequireSuccessError {
#[non_exhaustive] UnsuccessfulCommand {
invocation: Box<Invocation>,
status: ExitStatus,
stderr: Capture,
},
}Expand description
The error returned when a command ended without success
The error carries the three answers that the reader of a report needs: which command ran, how it ended, and what it said. A program states why it stopped on its standard error, so the error carries that capture and its message shows it.
The command ran. Nothing failed inside the crate, and the error exists because the caller stated that only success is acceptable.
The invocation travels in a box. A result carries its error by value, so the size of the error reaches every function that returns one. The box keeps the error small, and a caller that wraps it in an error of its own needs no box for it.
A later release can add variants, and it can add fields to a variant.
Match with a wildcard arm, and bind the fields of a variant with ...
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]UnsuccessfulCommand
The command ended without success
The exit status says how the command ended. A command that ran to its end reports a code, and a command that a signal stopped reports no code at all.
Fields
This variant is marked as non-exhaustive
invocation: Box<Invocation>The command that ended without success
status: ExitStatusThe status with which the command ended
Trait Implementations§
Source§impl Clone for RequireSuccessError
impl Clone for RequireSuccessError
Source§fn clone(&self) -> RequireSuccessError
fn clone(&self) -> RequireSuccessError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequireSuccessError
impl Debug for RequireSuccessError
Source§impl Display for RequireSuccessError
States which command ended how, and what it wrote about it
impl Display for RequireSuccessError
States which command ended how, and what it wrote about it
The message holds the capture of the standard error, because the reader of a report has only this message and the command wrote its reason there. A command that wrote nothing says so, so that no reader looks for a text that does not exist.
impl Eq for RequireSuccessError
Source§impl Error for RequireSuccessError
Reports the error to the tools of the ecosystem
impl Error for RequireSuccessError
Reports the error to the tools of the ecosystem
The error has no source. The command ran, and no other operation failed under this one.
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()