#[non_exhaustive]pub enum HttpClientError {
Build(Error),
InvalidRequest(Error),
Connect(Error),
Timeout(Error),
Redirect(Error),
Decode(Error),
Io(Error),
Other(Error),
}Expand description
An error produced while preparing or executing an HTTP request.
§Examples
use millipede_core::http_client::HttpClientError;
let error = HttpClientError::timeout(anyhow::anyhow!("deadline elapsed"));
assert!(error.is_timeout());
assert!(!error.is_connect());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Build(Error)
The HTTP client could not be built.
InvalidRequest(Error)
The request was invalid.
Connect(Error)
The remote endpoint could not be connected to.
Timeout(Error)
The request timed out.
Redirect(Error)
Redirect processing failed.
Decode(Error)
The response could not be decoded.
Io(Error)
An input/output operation failed.
Other(Error)
Another HTTP client error occurred.
Implementations§
Source§impl HttpClientError
impl HttpClientError
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Returns whether this error represents a connection failure.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns whether this error represents a timeout.
Sourcepub fn build(error: impl Into<Error>) -> HttpClientError
pub fn build(error: impl Into<Error>) -> HttpClientError
Creates a client-build error.
Sourcepub fn invalid_request(error: impl Into<Error>) -> HttpClientError
pub fn invalid_request(error: impl Into<Error>) -> HttpClientError
Creates an invalid-request error.
Sourcepub fn connect(error: impl Into<Error>) -> HttpClientError
pub fn connect(error: impl Into<Error>) -> HttpClientError
Creates a connection error.
Sourcepub fn timeout(error: impl Into<Error>) -> HttpClientError
pub fn timeout(error: impl Into<Error>) -> HttpClientError
Creates a timeout error.
Sourcepub fn redirect(error: impl Into<Error>) -> HttpClientError
pub fn redirect(error: impl Into<Error>) -> HttpClientError
Creates a redirect error.
Sourcepub fn decode(error: impl Into<Error>) -> HttpClientError
pub fn decode(error: impl Into<Error>) -> HttpClientError
Creates a response-decode error.
Sourcepub fn io(error: impl Into<Error>) -> HttpClientError
pub fn io(error: impl Into<Error>) -> HttpClientError
Creates an input/output error.
Sourcepub fn other(error: impl Into<Error>) -> HttpClientError
pub fn other(error: impl Into<Error>) -> HttpClientError
Creates an otherwise unclassified HTTP client error.
Trait Implementations§
Source§impl Debug for HttpClientError
impl Debug for HttpClientError
Source§impl Display for HttpClientError
impl Display for HttpClientError
Source§impl Error for HttpClientError
impl Error for HttpClientError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for HttpClientError
impl RefUnwindSafe for HttpClientError
impl Send for HttpClientError
impl Sync for HttpClientError
impl Unpin for HttpClientError
impl UnsafeUnpin for HttpClientError
impl UnwindSafe for HttpClientError
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
Mutably borrows from an owned value. Read more