#[non_exhaustive]pub enum UrlSafetyError {
InvalidUrl,
LimitExceeded {
limit: UrlSafetyLimit,
actual: usize,
max: usize,
},
Rejected {
status: u16,
},
Transient {
retry_after: Option<Duration>,
},
Provider(String),
}Expand description
URL-safety failures, mapped by the adapter from provider responses.
No variant carries the checked URL. It names the caller’s next
step, and an error string is one format! away from a log line. The
one variant carrying provider text is sanitized in Display, the way
MailError’s and PushError’s
are (issue #235): Display runs it through
crate::logging::scrub_text, so every tracing field, problem detail
and report line that renders the error gets the sanitized text.
Debug still shows the raw string for tests.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUrl
The input does not parse as a URL, or its scheme is not http or
https: nothing was sent anywhere. The offending text is
deliberately not carried.
LimitExceeded
A local ceiling was crossed and the provider was never called.
Rejected
The provider refused the request (a 4xx); not retryable without
a change. The status only — never the URL that drew it.
Transient
Retryable (a 5xx, a 429, a transport error); wait out
retry_after when the provider named one.
Provider(String)
The provider failed on its side, in its own (scrubbed) words.
Implementations§
Source§impl UrlSafetyError
impl UrlSafetyError
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
The provider-named back-off, where there was one.
Trait Implementations§
Source§impl Clone for UrlSafetyError
impl Clone for UrlSafetyError
Source§impl Debug for UrlSafetyError
impl Debug for UrlSafetyError
Source§impl Display for UrlSafetyError
impl Display for UrlSafetyError
impl Eq for UrlSafetyError
Source§impl Error for UrlSafetyError
impl Error for UrlSafetyError
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()
Source§impl PartialEq for UrlSafetyError
impl PartialEq for UrlSafetyError
impl StructuralPartialEq for UrlSafetyError
Auto Trait Implementations§
impl Freeze for UrlSafetyError
impl RefUnwindSafe for UrlSafetyError
impl Send for UrlSafetyError
impl Sync for UrlSafetyError
impl Unpin for UrlSafetyError
impl UnsafeUnpin for UrlSafetyError
impl UnwindSafe for UrlSafetyError
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.