pub enum HttpError {
Protocol(&'static str),
LimitExceeded(&'static str),
Incomplete(&'static str),
Io(Error),
}Expand description
A protocol, limit or transport failure while reading a response.
Variants§
Protocol(&'static str)
The peer’s bytes are not valid HTTP/1.x.
LimitExceeded(&'static str)
A configured limit was exceeded. The peer is either broken or hostile.
Incomplete(&'static str)
The peer’s stream ended before the message was complete.
Distinct from HttpError::Protocol because the peer did not speak
broken HTTP — it stopped speaking. That is a transient condition at the
connection level (the socket died, an idle-culled keep-alive was reused,
a gateway cut a long stream) rather than a judgement about the peer’s
syntax, and the two demand opposite retry verdicts. Folding them together
made one physical event — a peer closing a socket — retryable or terminal
depending on how politely it closed.
Io(Error)
The transport failed.
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub const fn class(&self) -> &'static str
pub const fn class(&self) -> &'static str
A stable, greppable classification for retry decisions.
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Whether a retry could plausibly succeed.
Transport failures and premature end-of-stream qualify: a fresh connection is a different connection, so the same request may well be answered. A peer speaking broken HTTP will speak it again, a limit will be exceeded again, and an unsupported encoding will stay unsupported.
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
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()