pub struct TaskException {
pub exc_type: String,
pub exc_message: String,
pub traceback: Vec<TracebackFrame>,
pub traceback_str: Option<String>,
pub category: ExceptionCategory,
pub cause: Option<Box<TaskException>>,
pub context: Option<Box<TaskException>>,
pub metadata: HashMap<String, Value>,
pub timestamp: Option<f64>,
pub hostname: Option<String>,
pub task_id: Option<String>,
}Expand description
A structured exception from task execution
Fields§
§exc_type: StringException type name (e.g., “ValueError”, “TimeoutError”)
exc_message: StringException message
traceback: Vec<TracebackFrame>Full traceback as structured frames
traceback_str: Option<String>Raw traceback string (for Python compatibility)
category: ExceptionCategoryException category
cause: Option<Box<TaskException>>Cause exception (for chained exceptions)
context: Option<Box<TaskException>>Context exception (for exception context)
metadata: HashMap<String, Value>Additional metadata
timestamp: Option<f64>Timestamp when exception occurred (Unix timestamp)
hostname: Option<String>Worker hostname where exception occurred
task_id: Option<String>Task ID that raised the exception
Implementations§
Source§impl TaskException
impl TaskException
Sourcepub fn new(exc_type: impl Into<String>, exc_message: impl Into<String>) -> Self
pub fn new(exc_type: impl Into<String>, exc_message: impl Into<String>) -> Self
Create a new task exception
Sourcepub fn from_error<E: Error>(error: &E) -> Self
pub fn from_error<E: Error>(error: &E) -> Self
Create from a Rust error
Sourcepub fn with_traceback(self, frames: Vec<(String, String, u32)>) -> Self
pub fn with_traceback(self, frames: Vec<(String, String, u32)>) -> Self
Add structured traceback frames
Sourcepub fn with_traceback_frames(self, frames: Vec<TracebackFrame>) -> Self
pub fn with_traceback_frames(self, frames: Vec<TracebackFrame>) -> Self
Add traceback frames
Sourcepub fn with_traceback_str(self, traceback: impl Into<String>) -> Self
pub fn with_traceback_str(self, traceback: impl Into<String>) -> Self
Add raw traceback string
Sourcepub fn with_category(self, category: ExceptionCategory) -> Self
pub fn with_category(self, category: ExceptionCategory) -> Self
Set exception category
Sourcepub fn with_cause(self, cause: TaskException) -> Self
pub fn with_cause(self, cause: TaskException) -> Self
Set cause exception
Sourcepub fn with_context(self, context: TaskException) -> Self
pub fn with_context(self, context: TaskException) -> Self
Set context exception
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata
Sourcepub fn with_timestamp(self, timestamp: f64) -> Self
pub fn with_timestamp(self, timestamp: f64) -> Self
Set timestamp
Sourcepub fn with_timestamp_now(self) -> Self
pub fn with_timestamp_now(self) -> Self
Set timestamp to now
Sourcepub fn with_hostname(self, hostname: impl Into<String>) -> Self
pub fn with_hostname(self, hostname: impl Into<String>) -> Self
Set hostname
Sourcepub fn with_task_id(self, task_id: impl Into<String>) -> Self
pub fn with_task_id(self, task_id: impl Into<String>) -> Self
Set task ID
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Check if this exception is retryable
Sourcepub const fn is_ignorable(&self) -> bool
pub const fn is_ignorable(&self) -> bool
Check if this exception should be ignored
Sourcepub fn exception_chain(&self) -> Vec<&TaskException>
pub fn exception_chain(&self) -> Vec<&TaskException>
Get the full exception chain as a vector
Sourcepub fn format_traceback(&self) -> String
pub fn format_traceback(&self) -> String
Format the traceback as a string
Sourcepub fn to_celery_format(&self) -> Value
pub fn to_celery_format(&self) -> Value
Convert to Celery-compatible format
Trait Implementations§
Source§impl Clone for TaskException
impl Clone for TaskException
Source§fn clone(&self) -> TaskException
fn clone(&self) -> TaskException
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more