scuffle_http/
error.rs

1use std::fmt::Debug;
2
3use crate::service::{HttpService, HttpServiceFactory};
4
5/// An error that can occur when creating or running an HTTP server.
6#[derive(Debug, thiserror::Error)]
7pub enum Error<F>
8where
9    F: HttpServiceFactory,
10    F::Error: std::error::Error,
11    <F::Service as HttpService>::Error: std::error::Error,
12    <<F::Service as HttpService>::ResBody as http_body::Body>::Error: std::error::Error,
13{
14    #[error("io error: {0}")]
15    Io(#[from] std::io::Error),
16    #[error("{0}")]
17    #[cfg(all(feature = "http3", feature = "tls-rustls"))]
18    #[cfg_attr(docsrs, doc(cfg(all(feature = "http3", feature = "tls-rustls"))))]
19    NoInitialCipherSuite(#[from] h3_quinn::quinn::crypto::rustls::NoInitialCipherSuite),
20    #[error("h3 error: {0}")]
21    #[cfg(feature = "http3")]
22    #[cfg_attr(docsrs, doc(cfg(feature = "http3")))]
23    H3(#[from] h3::Error),
24    #[error("hyper connection: {0}")]
25    #[cfg(any(feature = "http1", feature = "http2"))]
26    #[cfg_attr(docsrs, doc(cfg(any(feature = "http1", feature = "http2"))))]
27    HyperConnection(Box<dyn std::error::Error + Send + Sync>),
28    #[error("quinn connection error: {0}")]
29    #[cfg(feature = "http3")]
30    #[cfg_attr(docsrs, doc(cfg(feature = "http3")))]
31    QuinnConnection(#[from] h3_quinn::quinn::ConnectionError),
32    #[error("make service error: {0}")]
33    ServiceFactoryError(F::Error),
34    #[error("service error: {0}")]
35    ServiceError(<F::Service as HttpService>::Error),
36    #[error("response body error: {0}")]
37    ResBodyError(<<F::Service as HttpService>::ResBody as http_body::Body>::Error),
38}