#[non_exhaustive]pub enum Error {
Show 13 variants
InvalidUrl(String),
InvalidCidr(String),
RefusedHeader(String),
#[non_exhaustive] Denied {
host: String,
addr: IpAddr,
},
#[non_exhaustive] NoSource {
host: String,
},
#[non_exhaustive] Resolve {
host: String,
source: Error,
},
BadRedirect(String),
TooManyRedirects(usize),
BodyTooLarge(usize),
Timeout(Duration),
#[non_exhaustive] Connect {
host: String,
source: Error,
},
Tls(String),
Http(Box<dyn Error + Send + Sync>),
}Expand description
Why a fetch or connect didn’t happen, or didn’t finish.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUrl(String)
The URL isn’t an absolute http:// or https:// URL with a host, or
it carries a user name or password.
InvalidCidr(String)
A string passed as an address block didn’t parse.
RefusedHeader(String)
The request sets a header this crate won’t send for you, such as
Host or Content-Length. See Request::header.
#[non_exhaustive]Denied
The host is, or resolves to, an address the policy refuses. One such address refuses the whole name.
The message leaves the address out when the host is a name, so it’s
safe to show to whoever typed the URL. addr is for your logs. Shown
to the user, it tells them what your internal names resolve to.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NoSource
The policy has a source address, but none in any family the host resolved to.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Resolve
The name didn’t resolve, or resolved to nothing.
Fields
This variant is marked as non-exhaustive
BadRedirect(String)
A redirect had a Location that can’t be followed: unparseable, to a
scheme other than http and https, or with a user name or password.
TooManyRedirects(usize)
The chain was longer than the policy’s redirect limit.
BodyTooLarge(usize)
The body was larger than the policy’s limit.
Timeout(Duration)
The policy’s timeout ran out. It covers every hop of a fetch.
#[non_exhaustive]Connect
No TCP connection could be made to any of the host’s addresses.
Fields
This variant is marked as non-exhaustive
Tls(String)
The TLS client couldn’t be set up, usually because the system has no trust store to verify certificates against.
Http(Box<dyn Error + Send + Sync>)
The request failed after it was allowed: refused, reset, a bad certificate. This is the HTTP client’s own error, with the URL taken out of it.
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()