#[non_exhaustive]pub enum Error {
Show 13 variants
StackBuild {
retryable: bool,
source: Box<dyn StdError + Send + Sync>,
},
Resolution {
host: String,
retryable: bool,
source: ResolveError,
},
Connect {
host: String,
port: u16,
source: Box<dyn StdError + Send + Sync>,
},
Tls {
host: String,
source: Box<dyn StdError + Send + Sync>,
},
StreamReset {
code: u64,
},
Protocol {
source: Box<dyn StdError + Send + Sync>,
},
ConnectionLimit,
TunnelRefused {
status: StatusCode,
},
BodyTooLarge {
limit: usize,
},
Timeout {
phase: TimeoutPhase,
timeout: Duration,
},
InvalidBody {
source: FromUtf8Error,
},
InvalidRequest {
reason: Cow<'static, str>,
},
Closed,
}Expand description
Any failure on the request path.
The variants follow the phases of a request: building connectivity,
resolving the origin, connecting to it, and exchanging the request and
response. is_retryable classifies each error once,
so callers branch on that instead of re-deriving the answer from the
variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StackBuild
Building SCION connectivity (the stack or the resolver) failed.
Fields
Resolution
SCION name resolution for the origin’s host failed: the DNS lookup itself failed, or the host has no valid TSAR TXT records.
Fields
retryable: boolWhether retrying may succeed (the lookup failed, as opposed to the host having no valid records).
source: ResolveErrorThe underlying resolver error.
Connect
No connection to the origin could be established: every candidate address failed with a socket, QUIC, or handshake error.
Fields
Tls
The TLS layer rejected the origin: every candidate negotiated an ALPN other than HTTP/3.
A certificate that fails to validate does not land here: the transport
reports it as a failed handshake, indistinguishable from an unreachable
peer, so it surfaces as Connect.
Fields
StreamReset
The peer reset the request stream.
Protocol
An HTTP/3 protocol violation occurred on an established connection.
ConnectionLimit
The peer’s concurrent-stream limit is exhausted; the request was never sent.
TunnelRefused
The server refused the CONNECT tunnel with a non-2xx status.
Fields
status: StatusCodeThe status of the CONNECT response.
BodyTooLarge
The response body exceeded the size limit passed to
Response::bytes or
Response::text.
Timeout
A deadline expired.
Fields
phase: TimeoutPhaseThe phase of the request that timed out.
InvalidBody
The response body is not valid UTF-8 (only from
Response::text).
Fields
source: FromUtf8ErrorThe underlying UTF-8 error.
InvalidRequest
The request is invalid (malformed URL, unsupported scheme, missing host, or an invalid header).
Closed
The client has been closed with Client::close.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether retrying the request may succeed.
Transient conditions (connectivity, timeouts, stream resets, stream
limits, a 5xx tunnel refusal) are retryable. Deterministic ones (TLS
rejection, protocol violations, invalid requests, oversized bodies, a
4xx tunnel refusal, a closed client) are not. For
StackBuild and Resolution the
answer is decided when the error is constructed, from the transience of
the underlying failures.
A retryable error never implies the request did not reach the server: only the caller knows whether its request is idempotent.
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<BuildRequestError> for Error
impl From<BuildRequestError> for Error
Source§fn from(error: BuildRequestError) -> Self
fn from(error: BuildRequestError) -> Self
An invalid request is an Error::InvalidRequest, so the convenience
entry points (Client::get,
Client::post) report builder failures through
the same taxonomy as the rest of the request path.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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