#[non_exhaustive]pub enum StepError {
MissingFixture {
name: String,
ty: String,
step: String,
},
ExecutionError {
pattern: String,
function: String,
message: String,
},
PanicError {
pattern: String,
function: String,
message: String,
},
}Expand description
Error type produced by step wrappers.
The variants categorize the possible failure modes when invoking a step.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MissingFixture
Raised when a required fixture is absent from the StepContext.
Fields
ExecutionError
Raised when the invoked step function returns an Err variant.
Fields
PanicError
Raised when the step function panics during execution.
Implementations§
Source§impl StepError
impl StepError
Sourcepub fn format_with_loader(&self, loader: &FluentLanguageLoader) -> String
pub fn format_with_loader(&self, loader: &FluentLanguageLoader) -> String
Render the error message using the provided Fluent loader.
§Examples
let loader: FluentLanguageLoader = {
let mut loader = fluent_language_loader!();
i18n_embed::select(&loader, &Localizations, &[langid!("en-US")]).unwrap();
loader
};
let error = StepError::MissingFixture {
name: "db".into(),
ty: "Pool".into(),
step: "Given a database".into(),
};
let message = error.format_with_loader(&loader);
// Check the key components (name, type, step) rather than exact format.
assert!(message.contains("db"));
assert!(message.contains("Pool"));
assert!(message.contains("Given a database"));Trait Implementations§
Source§impl Error for StepError
impl Error for StepError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
impl Eq for StepError
impl StructuralPartialEq for StepError
Auto Trait Implementations§
impl Freeze for StepError
impl RefUnwindSafe for StepError
impl Send for StepError
impl Sync for StepError
impl Unpin for StepError
impl UnwindSafe for StepError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.