pub enum NcmError {
Http(Error),
Api {
code: i64,
msg: String,
},
AuthRequired(String),
InvalidParam(String),
Crypto(String),
Json(Error),
Timeout(String),
RateLimited(String),
Unknown(String),
}Variants§
Http(Error)
HTTP 请求失败(网络错误、DNS 解析失败等)
Api
API 业务错误(网易云返回非 200 状态码)
AuthRequired(String)
需要登录(API 返回 301)
InvalidParam(String)
参数错误(缺少必要参数或格式不正确)
Crypto(String)
加密/解密错误
Json(Error)
JSON 序列化/反序列化错误
Timeout(String)
请求超时
RateLimited(String)
触发风控/限流(API 返回 503 或 IP 高频)
Unknown(String)
其他错误
Implementations§
Trait Implementations§
Source§impl Error for NcmError
impl Error for NcmError
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 NcmError
impl !RefUnwindSafe for NcmError
impl Send for NcmError
impl Sync for NcmError
impl Unpin for NcmError
impl UnsafeUnpin for NcmError
impl !UnwindSafe for NcmError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.