pub enum Error {
Config(String),
Url(ParseError),
Http(Error),
Json(Error),
Api {
status: u16,
error: Box<ApiError>,
},
Exception {
status: u16,
exception: Box<ApiException>,
},
Unexpected {
status: u16,
body: String,
},
}Expand description
All errors the SDK can produce.
See the error module docs for the dispatch logic between
Error::Api and Error::Exception.
Variants§
Config(String)
Returned when Client::builder is
missing required state, or when an option is malformed (e.g. an
auth value that can’t be put in an HTTP header).
Url(ParseError)
The configured base URL or a derived endpoint URL failed to parse.
Http(Error)
A network or HTTP-level failure: connection refused, timeout, TLS error, mid-stream disconnect, etc.
Json(Error)
The response body couldn’t be (de)serialized as JSON.
You shouldn’t see this for normal operation — open an issue if you do, since it usually means the API has drifted from the version of the spec this crate was built against.
Api
Structured error returned by the v3 endpoints.
Endpoints that surface this variant: /sms/3/messages,
/sms/3/reports, /sms/3/logs.
Fields
Exception
Legacy ApiException returned by the v1 endpoints.
Endpoints that surface this variant: /sms/1/preview,
/sms/1/bulks (and .../status), /sms/1/inbox/reports,
/ct/1/log/end/{messageId}.
Unexpected
The server returned a non-2xx response whose body matched neither error schema. The raw body is preserved verbatim.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe 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
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.