Skip to main content

sbe_proxy/
error.rs

1/// Errors from the sbe proxy server.
2#[derive(Debug, thiserror::Error)]
3pub enum ProxyError {
4    #[error("invalid proxy configuration: {0}")]
5    Config(String),
6
7    /// Failed to bind the TCP listener.
8    #[error("failed to bind proxy listener: {0}")]
9    Bind(#[source] std::io::Error),
10
11    /// Failed to accept a connection.
12    #[error("failed to accept connection: {0}")]
13    Accept(#[source] std::io::Error),
14
15    /// Failed to connect to upstream.
16    #[error("failed to connect to upstream {host}:{port}: {source}")]
17    UpstreamConnect {
18        host: String,
19        port: u16,
20        source: std::io::Error,
21    },
22
23    #[error("proxy protocol error: {0}")]
24    Protocol(String),
25
26    #[error("proxy request exceeded {0} limit")]
27    Limit(&'static str),
28
29    #[error("proxy operation timed out while reading {0}")]
30    Timeout(&'static str),
31
32    #[error("proxy authentication failed")]
33    Unauthorized,
34
35    #[error("proxy destination rejected: {0}")]
36    Destination(String),
37
38    #[error("proxy I/O: {0}")]
39    Io(#[from] std::io::Error),
40}