#[non_exhaustive]pub enum HttpError {
InvalidRequest(String),
Transport {
message: String,
connect_phase: bool,
phase: Phase,
},
Timeout {
message: String,
phase: Phase,
},
Status {
status: u16,
body: String,
retry_after: Option<Duration>,
attempts: u32,
},
BodyTooLarge {
limit: usize,
},
Json(String),
Stream(String),
Cancelled,
SystemProxyUnsupported {
element: String,
},
AddressDenied {
host: String,
addr: Option<IpAddr>,
class: Option<AddressClass>,
reason: String,
},
HttpsRequired {
host: String,
scheme: String,
redirect: bool,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidRequest(String)
URL, header, or request construction failed before anything was sent.
Transport
Connection, TLS, socket failure, or exhausted redirect limit.
connect_phase is true when nothing
can have reached the server (safe to retry any method); it is true exactly when
phase is Phase::Connect.
Timeout
A configured timeout elapsed. message names the elapsed timeout.
Status
Non-2xx response (after retries were exhausted or not applicable).
BodyTooLarge
Response body exceeded the configured limit.
Json(String)
Response was not valid JSON for the requested type.
Stream(String)
Streaming protocol violation (oversized SSE line, bad UTF-8, …).
Cancelled
The call was cancelled through a crate::CancelToken.
SystemProxyUnsupported
ProxyMode::System: the Windows proxy settings hold
something this version cannot follow exactly, named in element: different proxy
routes for HTTP and HTTPS, a bypass entry that is not a plain host (<local>, an entry
limited to one scheme, an inner wildcard), a proxy auto-config script, or automatic
detection. The client sends nothing: it never drops a bypass entry while still using
the proxy, and never sends one scheme to the other’s proxy. Returned by
Client::try_new and by every request of a client built with Client::new. An app
catches it and uses the mode it used before (ProxyMode::Environment, or
ProxyMode::Explicit). Never retried.
AddressDenied
The outbound address policy refused the destination (see crate::netpolicy).
addr and class are None when the denial is about the name or scheme (no
address, a metadata host name, or a host outside a first-party list). reason
carries the detail, including custom deny_if text. Never retried.
HttpsRequired
crate::ClientConfig::https_only is set and the URL (or a redirect target when
redirect is true) is not https. scheme is lowercase, host has no
credentials. Nothing was sent to that URL. Never retried.
Implementations§
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
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()