iceberg_rust_spec/
error.rs1use thiserror::Error;
6
7#[derive(Error, Debug)]
8pub enum Error {
10 #[error("{0} doesn't have the right format")]
12 InvalidFormat(String),
13 #[error("Value {0} doesn't have the {1} type.")]
15 Type(String, String),
16 #[error("Column {0} not in schema {1}.")]
18 ColumnNotInSchema(String, String),
19 #[error("Failed to convert {0} to {1}.")]
21 Conversion(String, String),
22 #[error("{0} not found.")]
24 NotFound(String),
25 #[error("Feature {0} is not supported.")]
27 NotSupported(String),
28 #[error(transparent)]
30 Avro(Box<apache_avro::Error>),
31 #[error(transparent)]
33 JSONSerde(#[from] serde_json::Error),
34 #[error(transparent)]
36 Chrono(#[from] chrono::ParseError),
37 #[error(transparent)]
39 Uuid(#[from] uuid::Error),
40 #[error(transparent)]
42 IO(#[from] std::io::Error),
43 #[error(transparent)]
45 TryFromSlice(#[from] std::array::TryFromSliceError),
46 #[error(transparent)]
48 TryFromInt(#[from] std::num::TryFromIntError),
49 #[error(transparent)]
51 UTF8(#[from] std::str::Utf8Error),
52 #[error(transparent)]
54 FromUTF8(#[from] std::string::FromUtf8Error),
55 #[error(transparent)]
57 ParseInt(#[from] std::num::ParseIntError),
58 #[error(transparent)]
60 DeriveBuilder(#[from] derive_builder::UninitializedFieldError),
61}
62
63impl From<apache_avro::Error> for Error {
64 fn from(err: apache_avro::Error) -> Self {
65 Error::Avro(Box::new(err))
66 }
67}