use thiserror::Error;
#[derive(Debug, Error)]
pub enum BackendError {
#[error("backend I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("backend closed connection unexpectedly")]
Closed,
#[error("protocol violation: {0}")]
Protocol(String),
#[error("backend error: {0}")]
BackendError(String),
#[error("authentication failed: {0}")]
Auth(String),
#[error("TLS error: {0}")]
Tls(String),
#[error("unsupported type OID: {0}")]
UnsupportedType(u32),
#[error("value parse error: column {column}: {reason}")]
ParseValue { column: String, reason: String },
}
pub type BackendResult<T> = std::result::Result<T, BackendError>;