pub type SecurityError = CoreError;Expand description
安全服务错误类型 - 完全基于 CoreError
Aliased Type§
pub enum SecurityError {
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>,
},
ResponseTooLarge {
limit: u64,
actual: u64,
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>错误上下文
服务不可用错误
ResponseTooLarge
响应体大小超过限制
Internal
内部错误
Trait Implementations§
Source§impl SecurityErrorExt for SecurityError
impl SecurityErrorExt for SecurityError
Source§fn is_device_error(&self) -> bool
fn is_device_error(&self) -> bool
检查是否为设备相关错误
Source§fn is_permission_error(&self) -> bool
fn is_permission_error(&self) -> bool
检查是否为权限相关错误
Source§fn is_compliance_error(&self) -> bool
fn is_compliance_error(&self) -> bool
检查是否为合规相关错误
Source§fn is_authentication_error(&self) -> bool
fn is_authentication_error(&self) -> bool
检查是否为认证相关错误
Source§fn security_operation(&self) -> Option<&str>
fn security_operation(&self) -> Option<&str>
获取安全操作类型
Source§fn affected_resource_id(&self) -> Option<&str>
fn affected_resource_id(&self) -> Option<&str>
获取受影响的资源ID
Source§fn to_security_event(&self) -> SecurityEvent
fn to_security_event(&self) -> SecurityEvent
生成安全事件报告