use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Connection error: {0}")]
Connection(String),
#[error("Protocol error: {0}")]
Protocol(String),
#[error("Compression error: {0}")]
Compression(String),
#[error("Type mismatch: expected {expected}, got {actual}")]
TypeMismatch {
expected: String,
actual: String,
},
#[error("Validation error: {0}")]
Validation(String),
#[error("Server error {code}: {message}")]
Server {
code: i32,
message: String,
},
#[error("Not implemented: {0}")]
NotImplemented(String),
#[error("Invalid argument: {0}")]
InvalidArgument(String),
#[error("Buffer overflow")]
BufferOverflow,
#[error("UTF-8 error: {0}")]
Utf8(#[from] std::str::Utf8Error),
}
pub type Result<T> = std::result::Result<T, Error>;