pub enum AuthError {
MissingCredentials(String),
QrTimeout,
Crypto(String),
Storage(String),
Transport(Error),
Other(Box<dyn Error + Send + Sync>),
}Expand description
wecomx-auth 统一错误。
AuthError::Transport:wecomx-transport 层错误透传(含后台 errcode 语义)。AuthError::Other仅用于意料之外的分支 / 系统失败;逻辑错误必须有自己的变体。
Variants§
MissingCredentials(String)
无可用凭据/token:需要授权但凭据缺失,或缺 bot 凭据无法静默刷新。
QrTimeout
扫码超时(5 分钟),请重试。
Crypto(String)
凭据加密/解密/密钥相关失败。
Storage(String)
凭据存储读写失败(落盘 / 删除等本地 IO)。
Transport(Error)
下层 transport 错误透传(网络 / HTTP / 协议解析 / 后台 errcode)。
Other(Box<dyn Error + Send + Sync>)
兜底:仅意料之外的分支 / 系统失败使用;逻辑错误必须有自己的变体。
Implementations§
Source§impl AuthError
impl AuthError
Sourcepub fn code(&self) -> i64
pub fn code(&self) -> i64
Category error code for this variant.
AuthError::Transport 委托内层 wecomx_transport::Error::code;
本层变体返回各自的 8933xx 码;AuthError::Other 返回共享兜底码 893999。
pub fn message(&self) -> String
Trait Implementations§
Source§impl Error for AuthError
impl Error for AuthError
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 !RefUnwindSafe for AuthError
impl !UnwindSafe for AuthError
impl Freeze for AuthError
impl Send for AuthError
impl Sync for AuthError
impl Unpin for AuthError
impl UnsafeUnpin for AuthError
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