pub enum EuroMailError {
Authentication(String),
Validation {
code: String,
message: String,
},
RateLimit {
retry_after: Option<u64>,
message: String,
},
NotFound(String),
Api {
status: u16,
code: String,
message: String,
},
Http(Error),
}Expand description
Errors returned by the EuroMail SDK.
All API methods return Result<T, EuroMailError>. HTTP-level errors from the
EuroMail API are mapped to specific variants based on status code, while
network and deserialization failures surface as EuroMailError::Http.
§Example
let client = EuroMail::new("em_live_key");
match client.get_email("nonexistent").await {
Err(EuroMailError::NotFound(msg)) => eprintln!("Not found: {msg}"),
Err(EuroMailError::RateLimit { retry_after, .. }) => {
eprintln!("Rate limited, retry after {retry_after:?}s");
}
Err(e) => eprintln!("Error: {e}"),
Ok(detail) => println!("Email: {}", detail.email.id),
}Variants§
Authentication(String)
Invalid or expired API key (HTTP 401).
Validation
Request failed validation — e.g. missing required fields (HTTP 422).
RateLimit
Too many requests. retry_after contains the suggested wait in seconds
if the server provided a Retry-After header (HTTP 429).
NotFound(String)
The requested resource does not exist (HTTP 404).
Api
Any other API error (HTTP 4xx/5xx).
Http(Error)
Network or deserialization error from the underlying HTTP client.
Trait Implementations§
Source§impl Debug for EuroMailError
impl Debug for EuroMailError
Source§impl Display for EuroMailError
impl Display for EuroMailError
Source§impl Error for EuroMailError
impl Error for EuroMailError
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 EuroMailError
impl !RefUnwindSafe for EuroMailError
impl Send for EuroMailError
impl Sync for EuroMailError
impl Unpin for EuroMailError
impl UnsafeUnpin for EuroMailError
impl !UnwindSafe for EuroMailError
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.