pub struct Error { /* private fields */ }Expand description
The Errors that may occur when processing a Request.
Note: Errors may include the full URI used to make the Request. If the URI
contains sensitive information (e.g. an API key as a query parameter), be
sure to remove it (without_uri)
Implementations§
Source§impl Error
impl Error
Sourcepub fn uri(&self) -> Option<&Uri>
pub fn uri(&self) -> Option<&Uri>
Returns a possible URI related to this error.
§Examples
// displays last stop of a redirect loop
let response = hpx::get("http://site.with.redirect.loop").send().await;
if let Err(e) = response {
if e.is_redirect() {
if let Some(final_stop) = e.uri() {
println!("redirect loop at {}", final_stop);
}
}
}Sourcepub fn uri_mut(&mut self) -> Option<&mut Uri>
pub fn uri_mut(&mut self) -> Option<&mut Uri>
Returns a mutable reference to the URI related to this error
This is useful if you need to remove sensitive information from the URI (e.g. an API key in the query), but do not want to remove the URI entirely.
Sourcepub fn with_uri(self, uri: Uri) -> Self
pub fn with_uri(self, uri: Uri) -> Self
Add a uri related to this error (overwriting any existing)
Sourcepub fn without_uri(self) -> Self
pub fn without_uri(self) -> Self
Strip the related uri from this error (if, for example, it contains sensitive information)
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_proxy_connect(&self) -> bool
pub fn is_proxy_connect(&self) -> bool
Returns true if the error is related to proxy connect
Sourcepub fn is_connection_reset(&self) -> bool
pub fn is_connection_reset(&self) -> bool
Returns true if the error is related to a connection reset.
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 is_upgrade(&self) -> bool
pub fn is_upgrade(&self) -> bool
Returns true if the error is related to upgrading the connection
Sourcepub fn is_websocket(&self) -> bool
Available on crate features ws-yawc or ws-fastwebsockets only.
pub fn is_websocket(&self) -> bool
ws-yawc or ws-fastwebsockets only.Returns true if the error is related to WebSocket operations
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the status code, if the error was generated from a response.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe 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
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