pub trait ShellErrorExt {
// Required methods
fn into_inner(self) -> Result<ShellError>;
fn into_labeled(self) -> Result<LabeledError>;
fn generic_error(self) -> Result<String>;
fn generic_msg(self) -> Result<String>;
}Expand description
Extensions for interrogating ShellError values in tests.
Required Methods§
Sourcefn into_inner(self) -> Result<ShellError>
fn into_inner(self) -> Result<ShellError>
Tries to convert into an inner value from a ShellError.
Useful if the error is expected to be a generic error that contains an inner error or a chained error that chained another error.
However, this function returns None
- if
innerofShellError::Genericis empty - if
sourcesofShellError::ChainedErroris empty - the error is none of the above types
So make sure that a None value is not surprise.
Sourcefn into_labeled(self) -> Result<LabeledError>
fn into_labeled(self) -> Result<LabeledError>
Extract the LabeledError from ShellError::LabeledError, if it is one.
Sourcefn generic_error(self) -> Result<String>
fn generic_error(self) -> Result<String>
Extract the error field from ShellError::Generic, if it is one.
Sourcefn generic_msg(self) -> Result<String>
fn generic_msg(self) -> Result<String>
Extract the message field from ShellError::Generic, if it is one.