pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("protocol error: {0}")]
Proto(#[from] nexora_proto::ProtoError),
#[error("io_uring error: {0}")]
Uring(#[from] liburing::UringError),
#[error("DNS error: {0}")]
Dns(#[from] cares::AresError),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("request cancelled")]
Cancelled,
#[error("operation timed out")]
Timeout,
#[error("body size {size} exceeds maximum {max}")]
BodyTooLarge {
size: usize,
max: usize,
},
#[error("DNS resolution failed for host `{host}`: {reason}")]
DnsResolutionFailed {
host: String,
reason: String,
},
#[error("connection closed by peer")]
ConnectionClosed,
#[error("connection pool exhausted for origin `{origin}`")]
PoolExhausted {
origin: String,
},
#[error("redirect limit ({max}) exceeded")]
TooManyRedirects {
max: usize,
},
#[error("invalid URI: {0}")]
InvalidUri(String),
#[error("invalid state: {0}")]
InvalidState(String),
}