use thiserror::Error;
pub type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
pub type Result<T> = std::result::Result<T, ProxyError>;
#[derive(Debug, Error)]
pub enum ProxyError {
#[error("invalid config: {0}")]
InvalidConfig(#[source] BoxError),
#[error("missing field: {0}")]
MissingField(#[source] BoxError),
#[error("parse error: {0}")]
ParseError(#[source] BoxError),
#[error("get proxy error: {0}")]
GetProxy(#[source] BoxError),
#[error("proxy not found")]
ProxyNotFound,
#[error("proxy not available: {0}")]
ProxyNotAvailable(#[source] BoxError),
#[error("proxy already expired")]
ProxyExpired,
#[error("proxy provider already expired")]
ProxyProviderExpired,
#[error("proxy connection failed")]
ProxyConnectionFailed,
#[error("proxy authentication failed")]
ProxyAuthenticationFailed,
}