pub struct WaeError {
pub kind: Box<WaeErrorKind>,
}Expand description
中心化错误类型
包含错误类型标识,支持国际化。
Fields§
§kind: Box<WaeErrorKind>错误类型
Implementations§
Source§impl WaeError
impl WaeError
Sourcepub fn new(kind: WaeErrorKind) -> Self
pub fn new(kind: WaeErrorKind) -> Self
创建新的错误
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
获取错误分类
Sourcepub fn http_status(&self) -> u16
pub fn http_status(&self) -> u16
获取 HTTP 状态码
Sourcepub fn invalid_format(
field: impl Into<String>,
expected: impl Into<String>,
) -> Self
pub fn invalid_format( field: impl Into<String>, expected: impl Into<String>, ) -> Self
创建无效格式错误
Sourcepub fn out_of_range(
field: impl Into<String>,
min: Option<String>,
max: Option<String>,
) -> Self
pub fn out_of_range( field: impl Into<String>, min: Option<String>, max: Option<String>, ) -> Self
创建超出范围错误
Sourcepub fn invalid_credentials() -> Self
pub fn invalid_credentials() -> Self
创建无效凭证错误
Sourcepub fn account_locked() -> Self
pub fn account_locked() -> Self
创建账户已锁定错误
Sourcepub fn user_not_found(identifier: impl Into<String>) -> Self
pub fn user_not_found(identifier: impl Into<String>) -> Self
创建用户未找到错误
Sourcepub fn user_already_exists(username: impl Into<String>) -> Self
pub fn user_already_exists(username: impl Into<String>) -> Self
创建用户已存在错误
Sourcepub fn invalid_token(reason: impl Into<String>) -> Self
pub fn invalid_token(reason: impl Into<String>) -> Self
创建无效令牌错误
Sourcepub fn token_expired() -> Self
pub fn token_expired() -> Self
创建令牌过期错误
Sourcepub fn token_not_valid_yet() -> Self
pub fn token_not_valid_yet() -> Self
创建令牌尚未生效错误
Sourcepub fn invalid_signature() -> Self
pub fn invalid_signature() -> Self
创建无效签名错误
Sourcepub fn missing_claim(claim: impl Into<String>) -> Self
pub fn missing_claim(claim: impl Into<String>) -> Self
创建缺少声明错误
Sourcepub fn invalid_claim(claim: impl Into<String>) -> Self
pub fn invalid_claim(claim: impl Into<String>) -> Self
创建无效声明错误
Sourcepub fn invalid_issuer(
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn invalid_issuer( expected: impl Into<String>, actual: impl Into<String>, ) -> Self
创建无效签发者错误
Sourcepub fn invalid_audience() -> Self
pub fn invalid_audience() -> Self
创建无效受众错误
Sourcepub fn permission_denied(action: impl Into<String>) -> Self
pub fn permission_denied(action: impl Into<String>) -> Self
创建权限拒绝错误
Sourcepub fn not_found(
resource_type: impl Into<String>,
identifier: impl Into<String>,
) -> Self
pub fn not_found( resource_type: impl Into<String>, identifier: impl Into<String>, ) -> Self
创建资源未找到错误
Sourcepub fn connection_failed(target: impl Into<String>) -> Self
pub fn connection_failed(target: impl Into<String>) -> Self
创建连接失败错误
创建服务不可用错误
Sourcepub fn storage_read_failed(path: impl Into<String>) -> Self
pub fn storage_read_failed(path: impl Into<String>) -> Self
创建存储读取失败错误
Sourcepub fn storage_write_failed(path: impl Into<String>) -> Self
pub fn storage_write_failed(path: impl Into<String>) -> Self
创建存储写入失败错误
Sourcepub fn storage_file_not_found(path: impl Into<String>) -> Self
pub fn storage_file_not_found(path: impl Into<String>) -> Self
创建存储文件未找到错误
Sourcepub fn database(kind: WaeErrorKind) -> Self
pub fn database(kind: WaeErrorKind) -> Self
创建数据库错误
Sourcepub fn database_connection_failed(reason: impl Into<String>) -> Self
pub fn database_connection_failed(reason: impl Into<String>) -> Self
创建数据库连接失败错误
Sourcepub fn execute_failed(
statement: Option<String>,
reason: impl Into<String>,
) -> Self
pub fn execute_failed( statement: Option<String>, reason: impl Into<String>, ) -> Self
创建执行失败错误
Sourcepub fn transaction_failed(reason: impl Into<String>) -> Self
pub fn transaction_failed(reason: impl Into<String>) -> Self
创建事务失败错误
Sourcepub fn cache_key_not_found(key: impl Into<String>) -> Self
pub fn cache_key_not_found(key: impl Into<String>) -> Self
创建缓存键未找到错误
Sourcepub fn serialization_failed(type_name: impl Into<String>) -> Self
pub fn serialization_failed(type_name: impl Into<String>) -> Self
创建序列化失败错误
Sourcepub fn deserialization_failed(type_name: impl Into<String>) -> Self
pub fn deserialization_failed(type_name: impl Into<String>) -> Self
创建反序列化失败错误
Sourcepub fn circuit_breaker_open(service: impl Into<String>) -> Self
pub fn circuit_breaker_open(service: impl Into<String>) -> Self
创建熔断器开启错误
Sourcepub fn rate_limit_exceeded(limit: u64) -> Self
pub fn rate_limit_exceeded(limit: u64) -> Self
创建限流超出错误
Sourcepub fn max_retries_exceeded(attempts: u32) -> Self
pub fn max_retries_exceeded(attempts: u32) -> Self
创建重试次数耗尽错误
Sourcepub fn bulkhead_full(max_concurrent: usize) -> Self
pub fn bulkhead_full(max_concurrent: usize) -> Self
创建舱壁已满错误
Sourcepub fn task_not_found(task_id: impl Into<String>) -> Self
pub fn task_not_found(task_id: impl Into<String>) -> Self
创建任务未找到错误
Sourcepub fn invalid_cron_expression(expression: impl Into<String>) -> Self
pub fn invalid_cron_expression(expression: impl Into<String>) -> Self
创建无效 Cron 表达式错误
Sourcepub fn task_execution_failed(
task_id: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn task_execution_failed( task_id: impl Into<String>, reason: impl Into<String>, ) -> Self
创建任务执行失败错误
Sourcepub fn scheduler_shutdown() -> Self
pub fn scheduler_shutdown() -> Self
创建调度器已关闭错误
Sourcepub fn operation_timeout(operation: impl Into<String>, timeout_ms: u64) -> Self
pub fn operation_timeout(operation: impl Into<String>, timeout_ms: u64) -> Self
创建操作超时错误
Sourcepub fn config_missing(key: impl Into<String>) -> Self
pub fn config_missing(key: impl Into<String>) -> Self
创建配置缺失错误
Sourcepub fn not_implemented(feature: impl Into<String>) -> Self
pub fn not_implemented(feature: impl Into<String>) -> Self
创建未实现错误
Sourcepub fn json_error(reason: impl Into<String>) -> Self
pub fn json_error(reason: impl Into<String>) -> Self
创建 JSON 错误
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WaeError
impl<'de> Deserialize<'de> for WaeError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Error for WaeError
impl Error for WaeError
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()
Auto Trait Implementations§
impl Freeze for WaeError
impl RefUnwindSafe for WaeError
impl Send for WaeError
impl Sync for WaeError
impl Unpin for WaeError
impl UnsafeUnpin for WaeError
impl UnwindSafe for WaeError
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