uxum_pools/error.rs
1//! Error types and error support code.
2
3/// Generalized error type used by any instrumented pool.
4#[derive(Debug, thiserror::Error)]
5pub enum Error<E: std::error::Error + Send + 'static> {
6 /// Pool operation not supported.
7 #[error("operation not supported")]
8 NotImplemented,
9 /// No available resources were found in the pool.
10 #[error("pool is exhausted")]
11 PoolExhausted,
12 /// Call would block the thread, and non-blocking operation was requested.
13 #[error("acquisition from pool would block execution")]
14 WouldBlock,
15 /// Resource acquisition took longer than the specified timeout.
16 #[error("connection acquisition timeout")]
17 AcquireTimeout,
18 /// Pool implementation-specific error.
19 // TODO: convert dyn to generic type
20 #[error("pool error: {0}")]
21 Pool(E),
22}