pub enum KeyComputeError {
Show 15 variants
AuthError(String),
PermissionDenied(String),
RateLimitExceeded(String),
RoutingFailed(String),
ProviderError(String),
ProviderTimeout(u64, String),
DatabaseError(String),
ConfigError(String),
Internal(String),
SerializationError(String),
ValidationError(String),
NotFound(String),
InvalidRequest(String),
NetworkError(String),
Timeout(String),
}Expand description
KeyCompute 统一错误类型
涵盖认证、路由、Provider、数据库、配置等所有错误场景。 所有变体都包含描述性信息,便于日志记录和错误追踪。
Variants§
AuthError(String)
认证失败(无效凭证、令牌过期等)
PermissionDenied(String)
权限不足
RateLimitExceeded(String)
限流触发
RoutingFailed(String)
路由失败,无可用 Provider
ProviderError(String)
上游 Provider 错误
ProviderTimeout(u64, String)
Provider 超时
DatabaseError(String)
数据库操作错误
ConfigError(String)
配置错误
Internal(String)
内部错误(不应暴露给用户的系统错误)
SerializationError(String)
序列化/反序列化错误
ValidationError(String)
验证错误
NotFound(String)
资源未找到
InvalidRequest(String)
请求参数错误
NetworkError(String)
网络连接错误
Timeout(String)
请求超时
Implementations§
Source§impl KeyComputeError
impl KeyComputeError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
判断错误是否可重试
认证错误、验证错误、未找到错误不应重试
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
获取错误类别(用于 API 响应分类)
Trait Implementations§
Source§impl Debug for KeyComputeError
impl Debug for KeyComputeError
Source§impl Display for KeyComputeError
impl Display for KeyComputeError
Source§impl Error for KeyComputeError
impl Error for KeyComputeError
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()
Source§impl From<Error> for KeyComputeError
impl From<Error> for KeyComputeError
Source§impl From<Error> for KeyComputeError
impl From<Error> for KeyComputeError
Source§impl From<Error> for KeyComputeError
impl From<Error> for KeyComputeError
Source§impl From<ParseError> for KeyComputeError
impl From<ParseError> for KeyComputeError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for KeyComputeError
impl RefUnwindSafe for KeyComputeError
impl Send for KeyComputeError
impl Sync for KeyComputeError
impl Unpin for KeyComputeError
impl UnsafeUnpin for KeyComputeError
impl UnwindSafe for KeyComputeError
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