systemprompt_database/resilience/error.rs
1//! The error type the resilience layer itself produces.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use std::time::Duration;
7
8#[derive(Debug, thiserror::Error)]
9pub enum ResilienceError<E> {
10 #[error("circuit breaker '{key}' is open; failing fast")]
11 CircuitOpen { key: String },
12
13 #[error("bulkhead '{key}' is saturated ({limit} concurrent permits in use)")]
14 BulkheadFull { key: String, limit: usize },
15
16 #[error("operation timed out after {after:?}")]
17 Timeout { after: Duration },
18
19 #[error(transparent)]
20 Inner(#[from] E),
21}