Skip to main content

reinhardt_db/pool/
errors.rs

1//! Error types for connection pooling
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum PoolError {
7	#[error("Pool is closed")]
8	PoolClosed,
9
10	#[error("Connection timeout")]
11	Timeout,
12
13	#[error("Pool exhausted (max connections reached)")]
14	PoolExhausted,
15
16	#[error("Invalid connection")]
17	InvalidConnection,
18
19	#[error("Database error: {0}")]
20	Database(#[from] sqlx::Error),
21
22	#[error("Configuration error: {0}")]
23	Config(String),
24
25	#[error("Connection error: {0}")]
26	Connection(String),
27
28	#[error("Pool not found: {0}")]
29	PoolNotFound(String),
30}
31
32pub type PoolResult<T> = Result<T, PoolError>;