pub enum MailError {
Unauthorized,
DomainNotVerified {
domain: String,
},
Invalid {
detail: String,
},
RateLimited {
retry_after: Option<Duration>,
},
Upstream(String),
Transport(String),
}Expand description
Mailer failures, mapped by the adapter from provider responses.
Every variant that carries provider text is sanitized in Display,
the same way DbError’s is (issue #235). “Never
includes the API key” was too weak a promise: the text an adapter
wraps is the provider’s own response, and a 422 from Resend quotes
the field it objected to — which for a send is the recipient
address. Display therefore runs it through
crate::logging::scrub_text, so every tracing field, problem
detail, report line and format! that renders a MailError gets the
sanitized text rather than each call site remembering to. Debug
still shows the raw string for tests; the logging formatters scrub
{:?} output too.
Variants§
The API key is missing, wrong or revoked.
DomainNotVerified
The sending domain is not verified with the provider, so nothing from it will be accepted until somebody adds the DNS records.
Invalid
The provider refused the message itself. detail is its
wording, so it can quote the recipient — see the type docs.
RateLimited
Too many sends; retry no earlier than retry_after when the
provider named one.
Upstream(String)
The provider failed on its side (a 5xx, an unparseable body).
Transport(String)
The request never got an answer: a socket, a DNS failure, a timeout.
Trait Implementations§
impl Eq for MailError
Source§impl Error for MailError
impl Error for MailError
1.30.0 · 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()
impl StructuralPartialEq for MailError
Auto Trait Implementations§
impl Freeze for MailError
impl RefUnwindSafe for MailError
impl Send for MailError
impl Sync for MailError
impl Unpin for MailError
impl UnsafeUnpin for MailError
impl UnwindSafe for MailError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.