pub type Error = CoreError;Expand description
🚨 OpenLark 客户端错误类型
直接类型别名,充分利用 CoreError 的强大功能
Aliased Type§
pub enum Error {
Network(Box<NetworkError>),
Authentication {
message: String,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
Api(Box<ApiError>),
Validation {
field: Cow<'static, str>,
message: String,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
Configuration {
message: String,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
Serialization {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
Business {
code: ErrorCode,
message: String,
ctx: Box<ErrorContext>,
},
Timeout {
duration: Duration,
operation: Option<String>,
ctx: Box<ErrorContext>,
},
RateLimit {
limit: u32,
window: Duration,
reset_after: Option<Duration>,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
ServiceUnavailable {
service: Cow<'static, str>,
retry_after: Option<Duration>,
code: ErrorCode,
ctx: Box<ErrorContext>,
},
Internal {
code: ErrorCode,
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
ctx: Box<ErrorContext>,
},
}Variants§
Network(Box<NetworkError>)
网络错误
Authentication
认证错误
Api(Box<ApiError>)
API 错误
Validation
验证错误
Fields
§
ctx: Box<ErrorContext>错误上下文
Configuration
配置错误
Serialization
序列化错误
Fields
§
ctx: Box<ErrorContext>错误上下文
Business
业务错误
Timeout
超时错误
RateLimit
限流错误
Fields
§
ctx: Box<ErrorContext>错误上下文
服务不可用错误
Internal
内部错误
Trait Implementations§
Source§impl ClientErrorExt for Error
impl ClientErrorExt for Error
Source§fn suggestion(&self) -> &'static str
fn suggestion(&self) -> &'static str
获取错误建议
Source§fn recovery_steps(&self) -> Vec<&'static str>
fn recovery_steps(&self) -> Vec<&'static str>
获取错误恢复步骤
Source§impl From<RegistryError> for Error
impl From<RegistryError> for Error
Source§fn from(err: RegistryError) -> Self
fn from(err: RegistryError) -> Self
Converts to this type from the input type.