pub enum HttpClientError {
RetryExhausted {
attempts: u32,
message: String,
},
CircuitOpen,
Timeout(Duration),
Connection(String),
InvalidUrl(String),
RequestBuild(String),
Response {
status: u16,
message: String,
},
Json(String),
Interceptor(String),
Http(Error),
UrlParse(ParseError),
Io(Error),
}Expand description
HTTP client errors.
Variants§
RetryExhausted
Request failed after all retries exhausted.
CircuitOpen
Circuit breaker is open, rejecting requests.
Timeout(Duration)
Request timed out.
Connection(String)
Connection error.
InvalidUrl(String)
Invalid URL.
RequestBuild(String)
Request building error.
Response
Response error.
Json(String)
JSON serialization/deserialization error.
Interceptor(String)
Interceptor error.
Http(Error)
Underlying HTTP client error.
UrlParse(ParseError)
URL parsing error.
Io(Error)
I/O error.
Implementations§
Source§impl HttpClientError
impl HttpClientError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Check if this is a timeout error.
Sourcepub fn is_connection(&self) -> bool
pub fn is_connection(&self) -> bool
Check if this is a connection error.
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Get the HTTP status code if this is a response 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()
Source§impl From<Error> for HttpClientError
impl From<Error> for HttpClientError
Source§impl From<Error> for HttpClientError
impl From<Error> for HttpClientError
Source§impl From<ParseError> for HttpClientError
impl From<ParseError> for HttpClientError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HttpClientError
impl !RefUnwindSafe for HttpClientError
impl Send for HttpClientError
impl Sync for HttpClientError
impl Unpin 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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.