Skip to main content

ringline_http/
error.rs

1use std::io;
2
3use ringline_h2::H2Error;
4
5/// Errors produced by the HTTP client.
6#[derive(Debug, thiserror::Error)]
7pub enum HttpError {
8    /// The connection was closed unexpectedly.
9    #[error("connection closed")]
10    ConnectionClosed,
11
12    /// HTTP/2 framing error.
13    #[error("h2 error: {0}")]
14    H2(#[from] H2Error),
15
16    /// I/O error.
17    #[error("io error: {0}")]
18    Io(#[from] io::Error),
19
20    /// Invalid URL or path.
21    #[error("invalid url: {0}")]
22    InvalidUrl(String),
23
24    /// Response parsing error.
25    #[error("parse error")]
26    Parse,
27
28    /// Request timed out.
29    #[error("timeout")]
30    Timeout,
31
32    /// H2 flow control blocked and could not be resolved.
33    #[error("flow control error")]
34    FlowControl,
35
36    /// All connections in a pool failed.
37    #[error("all connections failed")]
38    AllConnectionsFailed,
39
40    /// Protocol error (unexpected event, bad state).
41    #[error("protocol error: {0}")]
42    Protocol(String),
43
44    /// Decompression error.
45    #[error("decompression error: {0}")]
46    Decompress(String),
47}