pub enum PoolError {
Exhausted,
Timeout,
AlreadyAcquired,
NotAcquired,
InvalidConfig(String),
Internal(String),
Closed,
ConnectionFailed(String),
CircuitOpen,
RateLimited {
remaining: u64,
reset_at: i64,
},
}Expand description
连接池特有错误
Variants§
Exhausted
连接池耗尽
Timeout
获取连接超时
AlreadyAcquired
连接已被获取
NotAcquired
连接未被获取
InvalidConfig(String)
配置非法
Internal(String)
内部错误
Closed
连接池已关闭(close_all 后拒绝新 acquire)
ConnectionFailed(String)
连接创建失败(保留原始错误信息)
CircuitOpen
#88 修复:断路器已跳闸,拒绝请求以防级联失败
当 circuit-breaker feature 启用且 CircuitBreaker 处于 Open 状态时,
acquire/query_with_timeout 等方法会返回此错误,避免对下游数据库
造成更大压力。
RateLimited
#93 修复:限流器拒绝请求
当 rate-limit feature 启用且 RateLimiter 拒绝当前 key 时返回。
remaining 为本次窗口剩余配额(已为 0),reset_at 为窗口重置时间戳(毫秒)。
Implementations§
Trait Implementations§
Source§impl Error for PoolError
impl Error for PoolError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PoolError
impl RefUnwindSafe for PoolError
impl Send for PoolError
impl Sync for PoolError
impl Unpin for PoolError
impl UnsafeUnpin for PoolError
impl UnwindSafe for PoolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more