#[non_exhaustive]pub enum ErrorCategory {
Client,
Auth,
NotFound,
Conflict,
Transient,
Server,
}Expand description
引擎级错误分类(与具体 HTTP/传输层无关)。
用于下游统一适配(弹性重试、错误上报分桶、HTTP status 映射的中间层)。 HTTP status 映射属调用方传输层边界,不在引擎层硬编码。
is_client_error() = Client + Auth + NotFound;is_server_error() = Server +
Transient + Conflict。详见 BaseError::category 文档。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Client
调用方过错(参数错误、字段验证、序列化、插件依赖/配置/循环)
Auth
认证/授权失败(登录过期、Token 撤销、密码错误、权限不足)
NotFound
资源不存在(记录/用户/Action/表未找到)
Conflict
资源冲突(插件注册冲突)
Transient
瞬时故障(连接失败/超时/连接池/HTTP 超时/熔断打开),可重试
在 is_server_error 中视为服务端错误(可重试的服务端故障,
如连接超时 = HTTP 503 语义),但 is_client_error 中不视为客户端错误。
Server
服务端/基础设施错误(内部失败、配置错误、未知错误)
Trait Implementations§
Source§impl Clone for ErrorCategory
impl Clone for ErrorCategory
impl Copy for ErrorCategory
Source§impl Debug for ErrorCategory
impl Debug for ErrorCategory
impl Eq for ErrorCategory
Source§impl PartialEq for ErrorCategory
impl PartialEq for ErrorCategory
impl StructuralPartialEq for ErrorCategory
Auto Trait Implementations§
impl Forget for ErrorCategory
impl Freeze for ErrorCategory
impl Move for ErrorCategory
impl RefUnwindSafe for ErrorCategory
impl Send for ErrorCategory
impl Sync for ErrorCategory
impl Unpin for ErrorCategory
impl UnsafeUnpin for ErrorCategory
impl UnwindSafe for ErrorCategory
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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