pub enum BackendError {
InvalidRequest {
message: String,
},
ExecutionFailed {
message: String,
},
Unavailable {
message: String,
},
BudgetExceeded {
resource: String,
limit: String,
},
ContractFailed {
contract: String,
message: String,
},
UnsupportedCapability {
capability: BackendCapability,
},
AdapterError {
message: String,
},
RecallError {
message: String,
},
Timeout {
deadline_ms: u64,
elapsed_ms: u64,
},
CircuitOpen {
backend: String,
retry_after_ms: Option<u64>,
},
Retried {
message: String,
attempts: usize,
was_transient: bool,
},
Other {
message: String,
},
}Expand description
Error type for backend operations.
This is capability-agnostic - implementations can wrap their specific errors.
§Retryable Errors
Some errors are transient and can be retried:
Timeout- operation exceeded deadline but might succeed on retryUnavailable- backend temporarily unavailableExecutionFailed- if caused by transient infrastructure issues
Use is_retryable() to check if an error should trigger retry logic.
Variants§
InvalidRequest
Request validation failed (NOT retryable - fix the request)
ExecutionFailed
Backend execution failed (may be retryable depending on cause)
Backend is unavailable (retryable - try again later)
BudgetExceeded
Budget exceeded (NOT retryable - increase budget or reduce request)
ContractFailed
Contract validation failed (NOT retryable - output doesn’t match contract)
UnsupportedCapability
Capability not supported (NOT retryable - use different backend)
Fields
capability: BackendCapabilityAdapterError
Adapter not found or incompatible (NOT retryable - fix configuration)
RecallError
Recall operation failed (may be retryable)
Timeout
Operation timed out (retryable - might succeed with more time)
Fields
CircuitOpen
Circuit breaker is open (NOT retryable until circuit closes)
Fields
Retried
Retryable wrapper - indicates retry was attempted
Fields
Other
Generic error with context
Implementations§
Source§impl BackendError
impl BackendError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Retryable errors are transient and might succeed on retry:
- Timeout
- Unavailable
- Some ExecutionFailed (network issues, rate limits)
Non-retryable errors require intervention:
- InvalidRequest (fix the request)
- BudgetExceeded (increase budget)
- ContractFailed (output doesn’t match)
- UnsupportedCapability (use different backend)
- CircuitOpen (wait for circuit to close)
Sourcepub fn is_overload(&self) -> bool
pub fn is_overload(&self) -> bool
Check if this error indicates the backend is overloaded.
Used by circuit breakers to track failure patterns.
Trait Implementations§
Source§impl Clone for BackendError
impl Clone for BackendError
Source§fn clone(&self) -> BackendError
fn clone(&self) -> BackendError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more