use thiserror::Error;
#[derive(Error, Debug)]
pub enum ProxyError {
#[error("Proxy bind failed on {addr}: {source}")]
Bind {
addr: String,
#[source]
source: std::io::Error,
},
#[error("Host denied by filter: {host}: {reason}")]
HostDenied { host: String, reason: String },
#[error("Invalid session token")]
InvalidToken,
#[error("Unknown service prefix: {prefix}")]
UnknownService { prefix: String },
#[error("Upstream connection failed to {host}: {reason}")]
UpstreamConnect { host: String, reason: String },
#[error("External proxy error: {0}")]
ExternalProxy(String),
#[error("Credential loading error: {0}")]
Credential(String),
#[error("Configuration error: {0}")]
Config(String),
#[error("HTTP parse error: {0}")]
HttpParse(String),
#[error("OAuth2 token exchange error: {0}")]
OAuth2Exchange(String),
#[error("Proxy shutdown")]
Shutdown,
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
}
pub type Result<T> = std::result::Result<T, ProxyError>;