1use std::fmt::Debug;
3
4use crate::service::{HttpService, HttpServiceFactory};
5
6#[derive(Debug, thiserror::Error)]
8pub enum HttpError<F>
9where
10 F: HttpServiceFactory,
11 F::Error: std::error::Error,
12 <F::Service as HttpService>::Error: std::error::Error,
13 <<F::Service as HttpService>::ResBody as http_body::Body>::Error: std::error::Error,
14{
15 #[error("io error: {0}")]
17 Io(#[from] std::io::Error),
18 #[error("{0}")]
22 #[cfg(all(feature = "http3", feature = "tls-rustls"))]
23 #[cfg_attr(docsrs, doc(cfg(all(feature = "http3", feature = "tls-rustls"))))]
24 NoInitialCipherSuite(#[from] h3_quinn::quinn::crypto::rustls::NoInitialCipherSuite),
25 #[error("h3 error: {0}")]
29 #[cfg(feature = "http3")]
30 #[cfg_attr(docsrs, doc(cfg(feature = "http3")))]
31 H3(#[from] h3::Error),
32 #[error("hyper connection: {0}")]
34 #[cfg(any(feature = "http1", feature = "http2"))]
35 #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))]
36 HyperConnection(Box<dyn std::error::Error + Send + Sync>),
37 #[error("quinn connection error: {0}")]
39 #[cfg(feature = "http3")]
40 #[cfg_attr(docsrs, doc(cfg(feature = "http3")))]
41 QuinnConnection(#[from] h3_quinn::quinn::ConnectionError),
42 #[error("make service error: {0}")]
44 ServiceFactoryError(F::Error),
45 #[error("service error: {0}")]
47 ServiceError(<F::Service as HttpService>::Error),
48 #[error("response body error: {0}")]
50 ResBodyError(<<F::Service as HttpService>::ResBody as http_body::Body>::Error),
51}