pub struct RetryableErrorFilter {
pub patterns: Vec<ErrorPattern>,
pub error_types: Vec<String>,
}Expand description
Declarative filter for retryable errors.
When configured on a StepConfig, only errors matching the filter will be retried.
If no patterns and no error types are configured, all errors are retried (backward-compatible).
Patterns and error types are combined with OR logic: an error is retryable if it matches ANY pattern OR ANY error type.
§Example
use durable_execution_sdk::config::{RetryableErrorFilter, ErrorPattern};
let filter = RetryableErrorFilter {
patterns: vec![
ErrorPattern::Contains("timeout".to_string()),
ErrorPattern::Regex(regex::Regex::new(r"(?i)connection.*refused").unwrap()),
],
error_types: vec!["TransientError".to_string()],
};
assert!(filter.is_retryable("request timeout occurred"));
assert!(!filter.is_retryable("invalid input"));
assert!(filter.is_retryable_with_type("invalid input", "TransientError"));Fields§
§patterns: Vec<ErrorPattern>Error message patterns (string contains or regex).
error_types: Vec<String>Error type names to match against.
Implementations§
Source§impl RetryableErrorFilter
impl RetryableErrorFilter
Sourcepub fn is_retryable(&self, error_msg: &str) -> bool
pub fn is_retryable(&self, error_msg: &str) -> bool
Returns true if the error message is retryable according to this filter.
If no filters are configured (empty patterns and empty error_types),
returns true for all errors (backward-compatible default).
Otherwise, returns true if the error message matches any configured pattern.
Sourcepub fn is_retryable_with_type(&self, error_msg: &str, error_type: &str) -> bool
pub fn is_retryable_with_type(&self, error_msg: &str, error_type: &str) -> bool
Returns true if the error is retryable by message or type.
Uses OR logic: returns true if the error matches any pattern
OR if the error type matches any configured error type.
If no filters are configured, returns true for all errors.
Trait Implementations§
Source§impl Clone for RetryableErrorFilter
impl Clone for RetryableErrorFilter
Source§fn clone(&self) -> RetryableErrorFilter
fn clone(&self) -> RetryableErrorFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RetryableErrorFilter
impl Debug for RetryableErrorFilter
Source§impl Default for RetryableErrorFilter
impl Default for RetryableErrorFilter
Source§fn default() -> RetryableErrorFilter
fn default() -> RetryableErrorFilter
Auto Trait Implementations§
impl Freeze for RetryableErrorFilter
impl RefUnwindSafe for RetryableErrorFilter
impl Send for RetryableErrorFilter
impl Sync for RetryableErrorFilter
impl Unpin for RetryableErrorFilter
impl UnsafeUnpin for RetryableErrorFilter
impl UnwindSafe for RetryableErrorFilter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more