#[non_exhaustive]pub enum ExecutionError {
Skip {
message: Option<String>,
},
StepNotFound {
index: usize,
keyword: StepKeyword,
text: String,
feature_path: String,
scenario_name: String,
},
MissingFixtures(Arc<MissingFixturesDetails>),
HandlerFailed {
index: usize,
keyword: StepKeyword,
text: String,
error: Arc<StepError>,
feature_path: String,
scenario_name: String,
},
}Expand description
Error type for step execution failures.
This enum captures all failure modes during step execution, distinguishing between control flow signals (skip requests) and actual errors (missing steps, fixture validation failures, handler errors).
§Variants
Skip: Control flow signal indicating the step requested skipping. This is not an error condition but a deliberate execution path.StepNotFound: The step pattern was not found in the registry.MissingFixtures: Required fixtures were not available in the context.HandlerFailed: The step handler returned an error.
§Examples
use rstest_bdd::execution::ExecutionError;
let error = ExecutionError::Skip { message: Some("not implemented yet".into()) };
assert!(error.is_skip());
assert_eq!(error.skip_message(), Some("not implemented yet"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Skip
Step requested to skip execution.
StepNotFound
Step pattern not found in the registry.
Fields
keyword: StepKeywordThe step keyword (Given, When, Then, etc.).
MissingFixtures(Arc<MissingFixturesDetails>)
Required fixtures missing from context.
The details are wrapped in Arc to reduce the size of Result<T, ExecutionError>.
HandlerFailed
Step handler returned an error.
Fields
keyword: StepKeywordThe step keyword (Given, When, Then, etc.).
Implementations§
Source§impl ExecutionError
impl ExecutionError
Sourcepub fn is_skip(&self) -> bool
pub fn is_skip(&self) -> bool
Returns true if this error represents a skip request.
Skip requests are control flow signals, not actual errors. Use this method to distinguish between errors that should fail a test and skip signals that should mark the test as skipped.
§Examples
use rstest_bdd::execution::ExecutionError;
let skip = ExecutionError::Skip { message: None };
assert!(skip.is_skip());
let not_found = ExecutionError::StepNotFound {
index: 0,
keyword: rstest_bdd::StepKeyword::Given,
text: "missing".into(),
feature_path: "test.feature".into(),
scenario_name: "test".into(),
};
assert!(!not_found.is_skip());Sourcepub fn skip_message(&self) -> Option<&str>
pub fn skip_message(&self) -> Option<&str>
Returns the skip message if this is a skip error.
Returns None if this is not a skip error, or if the skip has no
message.
§Examples
use rstest_bdd::execution::ExecutionError;
let skip_with_msg = ExecutionError::Skip { message: Some("reason".into()) };
assert_eq!(skip_with_msg.skip_message(), Some("reason"));
let skip_no_msg = ExecutionError::Skip { message: None };
assert_eq!(skip_no_msg.skip_message(), None);
let not_skip = ExecutionError::StepNotFound {
index: 0,
keyword: rstest_bdd::StepKeyword::Given,
text: "missing".into(),
feature_path: "test.feature".into(),
scenario_name: "test".into(),
};
assert_eq!(not_skip.skip_message(), None);Source§impl ExecutionError
impl ExecutionError
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.
This allows formatting the error using a specific locale loader rather than the global default. This is useful when you need consistent locale handling across nested error types.
§Examples
use i18n_embed::fluent::fluent_language_loader;
use unic_langid::langid;
use rstest_bdd::execution::ExecutionError;
let loader = {
use i18n_embed::LanguageLoader;
use rstest_bdd::Localizations;
let loader = fluent_language_loader!();
i18n_embed::select(&loader, &Localizations, &[langid!("en-US")])
.expect("en-US locale should always be available");
loader
};
let error = ExecutionError::Skip { message: Some("not implemented".into()) };
let message = error.format_with_loader(&loader);
assert!(message.contains("skipped"));
assert!(message.contains("not implemented"));Trait Implementations§
Source§impl Clone for ExecutionError
impl Clone for ExecutionError
Source§fn clone(&self) -> ExecutionError
fn clone(&self) -> ExecutionError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more