pub enum DbError {
Show 21 variants
QueryError(String),
ConnectionError(String),
ConnectionRefused(String),
ConnectionTimeout(String),
PoolError(PoolError),
CacheError(CacheError),
TxError(TxError),
MigrationError(String),
Unsupported(String),
ConfigError(String),
SerdeError(String),
NotFound(String),
AlreadyExists(String),
ConstraintViolation(String),
NullValue(String),
InvalidInput(String),
Internal(String),
IoError(String),
Hook(String),
TenantError(String),
Validation(String),
}Expand description
数据库错误类型
Variants§
QueryError(String)
查询执行失败
ConnectionError(String)
连接失败
ConnectionRefused(String)
连接被拒绝
ConnectionTimeout(String)
连接超时
PoolError(PoolError)
连接池错误
CacheError(CacheError)
缓存错误
TxError(TxError)
事务错误
MigrationError(String)
迁移错误
Unsupported(String)
方言不支持
ConfigError(String)
配置错误
SerdeError(String)
序列化/反序列化错误
NotFound(String)
未找到
AlreadyExists(String)
已存在
ConstraintViolation(String)
约束冲突
NullValue(String)
非空字段出现 null 值
InvalidInput(String)
输入非法
Internal(String)
内部错误
IoError(String)
IO 错误
Hook(String)
钩子执行失败
TenantError(String)
多租户错误(如租户 ID 缺失、跨租户访问)
Validation(String)
数据验证失败(业务规则校验未通过,由 before_validate 钩子触发)
Implementations§
Trait Implementations§
Source§impl Error for DbError
impl Error for DbError
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()
Source§impl From<FromUtf8Error> for DbError
impl From<FromUtf8Error> for DbError
Source§fn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl<T> From<PoisonError<T>> for DbError
impl<T> From<PoisonError<T>> for DbError
Source§fn from(err: PoisonError<T>) -> Self
fn from(err: PoisonError<T>) -> Self
Converts to this type from the input type.
Source§impl From<TryFromIntError> for DbError
impl From<TryFromIntError> for DbError
Source§fn from(err: TryFromIntError) -> Self
fn from(err: TryFromIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DbError
impl RefUnwindSafe for DbError
impl Send for DbError
impl Sync for DbError
impl Unpin for DbError
impl UnsafeUnpin for DbError
impl UnwindSafe for DbError
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