pub struct RequestError(/* private fields */);Expand description
A transport-level failure from the underlying HTTP client.
Transparent over the underlying client error: it renders and sources through
to it, and derefs to it so its classification methods (for example
is_timeout) are callable without naming the client crate.
Methods from Deref<Target = Error>§
Sourcepub fn url(&self) -> Option<&Url>
pub fn url(&self) -> Option<&Url>
Returns a possible URL related to this error.
§Examples
// displays last stop of a redirect loop
let response = reqwest::get("http://site.with.redirect.loop").await;
if let Err(e) = response {
if e.is_redirect() {
if let Some(final_stop) = e.url() {
println!("redirect loop at {final_stop}");
}
}
}Sourcepub fn is_builder(&self) -> bool
pub fn is_builder(&self) -> bool
Returns true if the error is from a type Builder.
Sourcepub fn is_redirect(&self) -> bool
pub fn is_redirect(&self) -> bool
Returns true if the error is from a RedirectPolicy.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if the error is related to a timeout.
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Returns true if the error is related to the request
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Returns true if the error is related to connect
Sourcepub fn is_body(&self) -> bool
pub fn is_body(&self) -> bool
Returns true if the error is related to the request or response body
Sourcepub fn is_decode(&self) -> bool
pub fn is_decode(&self) -> bool
Returns true if the error is related to decoding the response’s body
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the status code, if the error was generated from a response.
Sourcepub fn is_upgrade(&self) -> bool
pub fn is_upgrade(&self) -> bool
Returns true if the error is related to a protocol upgrade request
Trait Implementations§
Source§impl Debug for RequestError
impl Debug for RequestError
Source§impl Deref for RequestError
impl Deref for RequestError
Source§impl Display for RequestError
impl Display for RequestError
Source§impl Error for RequestError
impl Error for RequestError
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()