pub enum SmsError {
Http(Error),
Serialization(Error),
Authentication {
code: String,
message: String,
request_id: String,
},
InvalidParameter {
code: String,
message: String,
request_id: String,
},
RateLimited {
code: String,
message: String,
retry_after: Option<Duration>,
request_id: String,
},
InsufficientBalance {
code: String,
message: String,
request_id: String,
},
Business {
code: String,
message: String,
request_id: String,
},
Internal {
code: String,
message: String,
request_id: String,
},
PartialFailure {
succeeded: Vec<SendStatus>,
failed: Vec<SendStatus>,
},
Configuration(String),
UnexpectedResponse(String),
}Variants§
Http(Error)
Serialization(Error)
Authentication
InvalidParameter
RateLimited
InsufficientBalance
Business
Internal
PartialFailure
Configuration(String)
UnexpectedResponse(String)
Implementations§
Source§impl SmsError
impl SmsError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
判断错误是否可重试
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
获取建议的重试延迟时间
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
获取请求ID(如果存在)
Sourcepub fn is_partial_failure(&self) -> bool
pub fn is_partial_failure(&self) -> bool
Sourcepub fn partial_results(&self) -> Option<(&[SendStatus], &[SendStatus])>
pub fn partial_results(&self) -> Option<(&[SendStatus], &[SendStatus])>
Sourcepub fn into_partial_results(self) -> Option<(Vec<SendStatus>, Vec<SendStatus>)>
pub fn into_partial_results(self) -> Option<(Vec<SendStatus>, Vec<SendStatus>)>
Trait Implementations§
Source§impl Error for SmsError
impl Error for SmsError
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 SmsError
impl !RefUnwindSafe for SmsError
impl Send for SmsError
impl Sync for SmsError
impl Unpin for SmsError
impl !UnwindSafe for SmsError
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.
Source§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP