use std::io;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("connection closed")]
ConnectionClosed,
#[error("not authenticated")]
NotAuthenticated,
#[error("authentication failed: {0}")]
AuthFailed(String),
#[error("protocol error: {0}")]
Protocol(String),
#[error("config error: {0}")]
Config(String),
#[error("io error: {0}")]
Io(#[from] io::Error),
#[error("no pending requests")]
NoPending,
#[error("all connections failed")]
AllConnectionsFailed,
#[error("too many in-flight operations")]
TooManyInFlight,
#[error("sequential API requires no in-flight fire_* ops; drain recv() first")]
PendingOpsInFlight,
}