pub struct ExecutionError {
pub category: ExecutionErrorCategory,
pub message: String,
pub retry_policy: RetryPolicy,
pub code: Option<String>,
pub attempt: u32,
pub step_id: Option<StepId>,
pub provider: Option<String>,
pub http_status: Option<u16>,
pub details: Option<Value>,
pub occurred_at: i64,
}Expand description
The primary error type for all execution failures
This structured error enables:
- Deterministic retry decisions
- Accurate billing (distinguishes user errors from system errors)
- Compliance narratives (full audit trail)
- HTTP/gRPC status code mapping
Fields§
§category: ExecutionErrorCategoryHigh-level error category
message: StringHuman-readable error message
retry_policy: RetryPolicyRetry policy for this error
code: Option<String>Specific error code within the category
attempt: u32Attempt number (1-indexed, for tracking retries)
step_id: Option<StepId>Step ID where the error occurred
provider: Option<String>Provider name (for LLM/Tool errors)
http_status: Option<u16>HTTP status code (if applicable)
details: Option<Value>Additional structured details
occurred_at: i64Timestamp when error occurred (milliseconds since epoch)
Implementations§
Source§impl ExecutionError
impl ExecutionError
Sourcepub fn new(category: ExecutionErrorCategory, message: impl Into<String>) -> Self
pub fn new(category: ExecutionErrorCategory, message: impl Into<String>) -> Self
Create a new ExecutionError with default retry policy for the category
Sourcepub fn with_attempt(self, attempt: u32) -> Self
pub fn with_attempt(self, attempt: u32) -> Self
Set the attempt number
Sourcepub fn with_step_id(self, step_id: StepId) -> Self
pub fn with_step_id(self, step_id: StepId) -> Self
Set the step ID
Sourcepub fn with_provider(self, provider: impl Into<String>) -> Self
pub fn with_provider(self, provider: impl Into<String>) -> Self
Set the provider name
Sourcepub fn with_http_status(self, status: u16) -> Self
pub fn with_http_status(self, status: u16) -> Self
Set the HTTP status code
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Set additional details
Sourcepub fn with_retry_policy(self, policy: RetryPolicy) -> Self
pub fn with_retry_policy(self, policy: RetryPolicy) -> Self
Override the retry policy
Sourcepub fn llm(code: LlmErrorCode, message: impl Into<String>) -> Self
pub fn llm(code: LlmErrorCode, message: impl Into<String>) -> Self
Create an LLM error
Sourcepub fn tool(code: ToolErrorCode, message: impl Into<String>) -> Self
pub fn tool(code: ToolErrorCode, message: impl Into<String>) -> Self
Create a tool error
Sourcepub fn policy_violation(message: impl Into<String>) -> Self
pub fn policy_violation(message: impl Into<String>) -> Self
Create a policy violation error
Sourcepub fn quota_exceeded(message: impl Into<String>) -> Self
pub fn quota_exceeded(message: impl Into<String>) -> Self
Create a quota exceeded error
Sourcepub fn kernel_internal(message: impl Into<String>) -> Self
pub fn kernel_internal(message: impl Into<String>) -> Self
Create a kernel internal error
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
Check if a retry should be attempted
Sourcepub fn retry_delay(&self) -> Duration
pub fn retry_delay(&self) -> Duration
Get the delay before the next retry attempt
Sourcepub fn next_attempt(self) -> Self
pub fn next_attempt(self) -> Self
Create a new error for the next retry attempt
Sourcepub fn to_http_status(&self) -> u16
pub fn to_http_status(&self) -> u16
Map to HTTP status code
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 moreSource§impl Debug for ExecutionError
impl Debug for ExecutionError
Source§impl<'de> Deserialize<'de> for ExecutionError
impl<'de> Deserialize<'de> for ExecutionError
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>,
Source§impl Display for ExecutionError
impl Display for ExecutionError
Source§impl Error for ExecutionError
impl Error for ExecutionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for ExecutionError
impl From<Error> for ExecutionError
Source§impl From<Error> for ExecutionError
impl From<Error> for ExecutionError
Source§impl From<Error> for ExecutionError
impl From<Error> for ExecutionError
Auto Trait Implementations§
impl Freeze for ExecutionError
impl RefUnwindSafe for ExecutionError
impl Send for ExecutionError
impl Sync for ExecutionError
impl Unpin for ExecutionError
impl UnsafeUnpin for ExecutionError
impl UnwindSafe for ExecutionError
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.