pub struct ExceptionPolicy {
pub retry_on: Vec<String>,
pub ignore_on: Vec<String>,
pub fail_on: Vec<String>,
pub reject_on: Vec<String>,
pub default_action: ExceptionAction,
pub preserve_traceback: bool,
pub max_traceback_depth: Option<usize>,
pub include_metadata: HashMap<String, bool>,
}Expand description
Policy for handling exceptions
Fields§
§retry_on: Vec<String>Exception types to retry on (by type name pattern)
ignore_on: Vec<String>Exception types to ignore (task succeeds despite exception)
fail_on: Vec<String>Exception types to fail on (no retry, go to DLQ)
reject_on: Vec<String>Exception types to reject (no retry, no DLQ)
default_action: ExceptionActionDefault action for unmatched exceptions
preserve_traceback: boolWhether to preserve full traceback
max_traceback_depth: Option<usize>Maximum traceback depth to preserve
include_metadata: HashMap<String, bool>Custom metadata to include in exceptions
Implementations§
Source§impl ExceptionPolicy
impl ExceptionPolicy
Sourcepub fn add_retry_on(self, exc_type: impl Into<String>) -> Self
pub fn add_retry_on(self, exc_type: impl Into<String>) -> Self
Add exception type to retry on
Sourcepub fn add_ignore_on(self, exc_type: impl Into<String>) -> Self
pub fn add_ignore_on(self, exc_type: impl Into<String>) -> Self
Add exception type to ignore
Sourcepub fn add_fail_on(self, exc_type: impl Into<String>) -> Self
pub fn add_fail_on(self, exc_type: impl Into<String>) -> Self
Add exception type to fail on
Sourcepub fn add_reject_on(self, exc_type: impl Into<String>) -> Self
pub fn add_reject_on(self, exc_type: impl Into<String>) -> Self
Add exception type to reject
Sourcepub fn with_default_action(self, action: ExceptionAction) -> Self
pub fn with_default_action(self, action: ExceptionAction) -> Self
Set default action
Sourcepub fn with_traceback(self, preserve: bool) -> Self
pub fn with_traceback(self, preserve: bool) -> Self
Set traceback preservation
Sourcepub fn with_max_traceback_depth(self, depth: usize) -> Self
pub fn with_max_traceback_depth(self, depth: usize) -> Self
Set maximum traceback depth
Sourcepub fn get_action(&self, exception: &TaskException) -> ExceptionAction
pub fn get_action(&self, exception: &TaskException) -> ExceptionAction
Get the action to take for an exception
Sourcepub fn process_exception(&self, exception: TaskException) -> TaskException
pub fn process_exception(&self, exception: TaskException) -> TaskException
Process an exception according to policy
Trait Implementations§
Source§impl Clone for ExceptionPolicy
impl Clone for ExceptionPolicy
Source§fn clone(&self) -> ExceptionPolicy
fn clone(&self) -> ExceptionPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExceptionPolicy
impl Debug for ExceptionPolicy
Source§impl Default for ExceptionPolicy
impl Default for ExceptionPolicy
Source§impl<'de> Deserialize<'de> for ExceptionPolicy
impl<'de> Deserialize<'de> for ExceptionPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ExceptionPolicy
impl RefUnwindSafe for ExceptionPolicy
impl Send for ExceptionPolicy
impl Sync for ExceptionPolicy
impl Unpin for ExceptionPolicy
impl UnwindSafe for ExceptionPolicy
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