#[non_exhaustive]pub enum Error {
Unauthorized,
RateLimited {
retry_after: Option<Duration>,
},
NotFound {
resource: String,
},
Business {
code: i64,
msg: String,
},
Transport(Error),
Decode(String),
WebSocket(String),
Request(Box<dyn StdError + Send + Sync>),
Api(String),
Parse(String),
}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.
认证失败(token 失效/未登录)
RateLimited
触发限流,retry_after 为服务端建议等待时长
NotFound
资源不存在
Business
业务层错误:服务端返回非 0 code
Transport(Error)
传输层错误(连接/超时/TLS 等)
Decode(String)
反序列化/解析错误
WebSocket(String)
WebSocket 连接/收发错误
Request(Box<dyn StdError + Send + Sync>)
Api(String)
Parse(String)
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Source§impl From<WebSocketError> for Error
impl From<WebSocketError> for Error
Source§fn from(err: WebSocketError) -> Self
fn from(err: WebSocketError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Forget for Error
impl Freeze for Error
impl Move for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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