use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("{0} doesn't have the right format")]
InvalidFormat(String),
#[error("Value {0} doesn't have the {1} type.")]
Type(String, String),
#[error("Column {0} not in schema {1}.")]
ColumnNotInSchema(String, String),
#[error("Failed to convert {0} to {1}.")]
Conversion(String, String),
#[error("{0} not found.")]
NotFound(String),
#[error("Feature {0} is not supported.")]
NotSupported(String),
#[error(transparent)]
Avro(Box<apache_avro::Error>),
#[error(transparent)]
JSONSerde(#[from] serde_json::Error),
#[error(transparent)]
Chrono(#[from] chrono::ParseError),
#[error(transparent)]
Uuid(#[from] uuid::Error),
#[error(transparent)]
IO(#[from] std::io::Error),
#[error(transparent)]
TryFromSlice(#[from] std::array::TryFromSliceError),
#[error(transparent)]
TryFromInt(#[from] std::num::TryFromIntError),
#[error(transparent)]
UTF8(#[from] std::str::Utf8Error),
#[error(transparent)]
FromUTF8(#[from] std::string::FromUtf8Error),
#[error(transparent)]
ParseInt(#[from] std::num::ParseIntError),
#[error(transparent)]
DeriveBuilder(#[from] derive_builder::UninitializedFieldError),
}
impl From<apache_avro::Error> for Error {
fn from(err: apache_avro::Error) -> Self {
Error::Avro(Box::new(err))
}
}