#[non_exhaustive]pub enum HttpError {
Show 16 variants
RequestBuild(Error),
InvalidHeaderName(InvalidHeaderName),
InvalidHeaderValue(InvalidHeaderValue),
Timeout(Duration),
DeadlineExceeded(Duration),
Transport(Box<dyn Error + Send + Sync>),
Tls(Box<dyn Error + Send + Sync>),
BodyTooLarge {
limit: usize,
actual: usize,
},
HttpStatus {
status: StatusCode,
body_preview: String,
content_type: Option<String>,
retry_after: Option<Duration>,
},
Json(Error),
FormEncode(Error),
Overloaded,
ServiceClosed,
InvalidUri {
url: String,
kind: InvalidUriKind,
reason: String,
},
InvalidScheme {
scheme: String,
reason: String,
},
#[non_exhaustive] Proxy {
kind: ProxyErrorKind,
proxy: String,
},
}Expand description
HTTP client error types
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RequestBuild(Error)
Request building failed
InvalidHeaderName(InvalidHeaderName)
Invalid header name
InvalidHeaderValue(InvalidHeaderValue)
Invalid header value
Timeout(Duration)
Single request attempt timed out
DeadlineExceeded(Duration)
Total operation deadline exceeded (including all retries)
Transport(Box<dyn Error + Send + Sync>)
Transport error (network, connection, etc)
Tls(Box<dyn Error + Send + Sync>)
TLS error
BodyTooLarge
Response body exceeded size limit
HttpStatus
HTTP non-2xx status
Fields
status: StatusCodeJson(Error)
JSON parsing error
FormEncode(Error)
Form URL encoding error
Overloaded
Service overloaded (concurrency limit reached, fail-fast)
ServiceClosed
Internal service failure (buffer worker died, channel closed)
InvalidUri
Invalid URL (failed to parse)
Use the kind field for programmatic matching. The reason field contains
a diagnostic message intended for logging only; do not match on its contents
as the format is unstable and may change between releases.
Fields
kind: InvalidUriKindStructured failure classification for programmatic matching
InvalidScheme
Invalid URL scheme for transport security configuration
#[non_exhaustive]Proxy
The outbound proxy is misconfigured or refused the CONNECT tunnel.
Replies of a proxy to plain HTTP requests are ordinary responses.
ProxyErrorKind::InvalidUrl, UnsupportedScheme and
AuthRequired are not retried: retrying a bad proxy URL or rejected
credentials repeats the same failure (and can lock the proxy account).
TunnelRejected is retried like a transport error.
Fields
This variant is marked as non-exhaustive
kind: ProxyErrorKindWhat went wrong.
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
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()
Source§impl From<InvalidHeaderName> for HttpError
impl From<InvalidHeaderName> for HttpError
Source§fn from(source: InvalidHeaderName) -> Self
fn from(source: InvalidHeaderName) -> Self
Source§impl From<InvalidHeaderValue> for HttpError
impl From<InvalidHeaderValue> for HttpError
Source§fn from(source: InvalidHeaderValue) -> Self
fn from(source: InvalidHeaderValue) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for HttpError
impl !UnwindSafe for HttpError
impl Forget for HttpError
impl Freeze for HttpError
impl Move for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl UnsafeUnpin for HttpErrorwhere
*const dyn Error + Sync + Send is !null: UnsafeUnpin,
PhantomData<dyn Error + Sync + Send>: UnsafeUnpin,
NonZeroU16Inner: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ErrorImpl is !null: UnsafeUnpin,
PhantomData<ErrorImpl>: UnsafeUnpin,
&'static str: UnsafeUnpin,
String: UnsafeUnpin,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ServiceExt for T
impl<T> ServiceExt for T
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read moreSource§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more