pub trait ShellErrorExt {
// Required methods
fn into_inner(self) -> Result<ShellError>;
fn into_labeled(self) -> Result<LabeledError>;
fn into_chained_iter(self) -> Result<impl Iterator<Item = ShellError>>;
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 TestErrorKind::NoInner
- if
innerofShellError::Genericis empty - if
sourcesofShellError::ChainedErroris empty - if
sourcesofShellError::EvalBlockWithInputis empty - the error is none of the above types
Also if multiple inner values are found a TestErrorKind::MultipleInner is returned.
Sourcefn into_labeled(self) -> Result<LabeledError>
fn into_labeled(self) -> Result<LabeledError>
Extract the LabeledError from ShellError::LabeledError, if it is one.
Sourcefn into_chained_iter(self) -> Result<impl Iterator<Item = ShellError>>
fn into_chained_iter(self) -> Result<impl Iterator<Item = ShellError>>
Extract the iterator on the sources of the [ChainedError] from
ShellError::ChainedError, it 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".