pub enum RelayError {
BadHost {
host: String,
reason: String,
},
Transport {
host: String,
reason: String,
},
Http {
host: String,
status: StatusCode,
error: String,
},
RateLimited {
host: String,
retry_after: Option<u64>,
},
Malformed {
host: String,
reason: String,
},
TimedOut {
host: String,
after: Duration,
},
}Expand description
Why a relay query failed. Every variant carries host, so a fan-out failure
is attributable without the caller threading context back in.
Note the deliberate absence of a field named source: thiserror treats
that name as #[source], which requires std::error::Error + 'static —
which anyhow::Error (what crate::net::guarded_get_no_privacy returns)
does not implement. Transport failures are therefore flattened to a String
built with anyhow’s alternate formatter, which preserves the whole context
chain in the one place it is consumed: the log line.
Variants§
BadHost
The configured host is not a usable http(s) target.
Transport
The request never produced a response (DNS, TLS, connect, SSRF refusal).
Http
The relay answered with a non-2xx status.
Fields
status: StatusCodeThe HTTP status.
RateLimited
The relay rate-limited us. Distinct from RelayError::Http because the
required behaviour differs: abort the run, log Retry-After, never retry
tighter.
retry_after is rendered INTO the Display string rather than only held
as a field. The scheduler logs err.to_string(), so a field the message
omits is unreachable — the value was parsed, stored, and then silently
dropped, leaving the operator with no idea how long to back off and
NETWORK-SPEC §4.6 (“warn! with Retry-After if present”) unmet.
Fields
Malformed
The body was not the expected JSON envelope.
TimedOut
The whole walk against one host blew its deadline.
Trait Implementations§
Source§impl Debug for RelayError
impl Debug for RelayError
Source§impl Display for RelayError
impl Display for RelayError
Source§impl Error for RelayError
impl Error for RelayError
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()
Auto Trait Implementations§
impl Freeze for RelayError
impl RefUnwindSafe for RelayError
impl Send for RelayError
impl Sync for RelayError
impl Unpin for RelayError
impl UnsafeUnpin for RelayError
impl UnwindSafe for RelayError
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more