use thiserror::Error;
#[derive(Debug, Error)]
pub enum ResilienceError {
#[error("budget exceeded: {kind} ({consumed}/{limit})")]
BudgetExceeded {
kind: &'static str,
consumed: u64,
limit: u64,
},
#[error("circuit open for {provider}/{model}: {failures} consecutive failures")]
CircuitOpen {
provider: String,
model: String,
failures: u32,
},
#[error("retries exhausted after {attempts} attempts: {source}")]
RetriesExhausted {
attempts: u32,
#[source]
source: anyhow::Error,
},
#[error("retry deadline exceeded after {elapsed_ms}ms ({attempts} attempts): {source}")]
DeadlineExceeded {
attempts: u32,
elapsed_ms: u64,
#[source]
source: anyhow::Error,
},
}