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 NoInitialCipherSuite(#[from] h3_quinn::quinn::crypto::rustls::NoInitialCipherSuite),
24 #[error("h3 connection error: {0}")]
28 #[cfg(feature = "http3")]
29 H3Connection(#[from] h3::error::ConnectionError),
30 #[error("h3 stream error: {0}")]
34 #[cfg(feature = "http3")]
35 H3Stream(#[from] h3::error::StreamError),
36 #[error("hyper connection: {0}")]
38 #[cfg(any(feature = "http1", feature = "http2"))]
39 HyperConnection(Box<dyn std::error::Error + Send + Sync>),
40 #[error("quinn connection error: {0}")]
42 #[cfg(feature = "http3")]
43 QuinnConnection(#[from] h3_quinn::quinn::ConnectionError),
44 #[error("make service error: {0}")]
46 ServiceFactoryError(F::Error),
47 #[error("service error: {0}")]
49 ServiceError(<F::Service as HttpService>::Error),
50 #[error("response body error: {0}")]
52 ResBodyError(<<F::Service as HttpService>::ResBody as http_body::Body>::Error),
53}