Skip to main content

orbit_client_pool/
error.rs

1use std::time::Duration;
2
3/// Invalid client-pool options.
4#[derive(Debug, thiserror::Error, Eq, PartialEq)]
5pub enum OptionsError {
6    #[error("client pool max_live must be greater than zero")]
7    ZeroMaxLive,
8    #[error("client pool max_concurrency must be greater than zero")]
9    ZeroMaxConcurrency,
10    #[error("fleet client pool requires an Orbit pool spec with fleet concurrency enabled")]
11    FleetConcurrencyDisabled,
12    #[error(
13        "client pool capacity must satisfy min_idle <= max_idle <= max_live; got {min_idle} <= {max_idle} <= {max_live}"
14    )]
15    CapacityOrder { min_idle: usize, max_idle: usize, max_live: usize },
16    #[error("client pool attempts must be greater than zero")]
17    ZeroAttempts,
18    #[error("client pool {0} must be greater than zero when present")]
19    ZeroDuration(&'static str)
20}
21
22/// Failure to acquire one client.
23#[derive(Debug, thiserror::Error)]
24pub enum AcquireError<E> {
25    #[error("client pool is closed")]
26    Closed,
27    #[error("client pool wait queue is full (maximum {max_waiting})")]
28    QueueFull { max_waiting: usize },
29    #[error("client pool is at its physical capacity")]
30    AtCapacity,
31    #[error("timed out acquiring a client after {0:?}")]
32    Timeout(Duration),
33    #[error("client acquisition was cancelled")]
34    Cancelled,
35    #[error("client manager failed: {0}")]
36    Manager(#[source] E)
37}