1use arrow::error::ArrowError;
6use thiserror::Error;
7
8#[derive(Error, Debug)]
9pub enum Error {
11 #[error("{0} doesn't have the right format")]
13 InvalidFormat(String),
14 #[error("Value {0} doesn't have the {1} type.")]
16 Type(String, String),
17 #[error("Column {0} not in schema {1}.")]
19 Schema(String, String),
20 #[error("Failed to convert {0} to {1}.")]
22 Conversion(String, String),
23 #[error("Failed to decompress gzip data: {0}")]
25 Decompress(String),
26 #[error("{0} not found.")]
28 NotFound(String),
29 #[error("Feature {0} is not supported.")]
31 NotSupported(String),
32 #[error("Entity not found in catalog")]
34 CatalogNotFound,
35 #[error(transparent)]
37 External(Box<dyn std::error::Error + Send + Sync>),
38 #[error(transparent)]
40 Iceberg(#[from] iceberg_rust_spec::error::Error),
41 #[error(transparent)]
43 Arrow(#[from] arrow::error::ArrowError),
44 #[error(transparent)]
46 Parquet(#[from] parquet::errors::ParquetError),
47 #[error(transparent)]
49 Avro(Box<apache_avro::Error>),
50 #[error(transparent)]
52 Thrift(#[from] thrift::Error),
53 #[error(transparent)]
55 SQLParser(#[from] sqlparser::parser::ParserError),
56 #[error(transparent)]
58 JSONSerde(#[from] serde_json::Error),
59 #[error(transparent)]
61 Uuid(#[from] uuid::Error),
62 #[error(transparent)]
64 Url(#[from] url::ParseError),
65 #[error(transparent)]
67 IO(#[from] std::io::Error),
68 #[error(transparent)]
70 FuturesChannel(#[from] futures::channel::mpsc::SendError),
71 #[error(transparent)]
73 TokioJoinError(#[from] tokio::task::JoinError),
74 #[error(transparent)]
76 ObjectStore(#[from] object_store::Error),
77 #[error(transparent)]
79 TryFromSlice(#[from] std::array::TryFromSliceError),
80 #[error(transparent)]
82 TryFromInt(#[from] std::num::TryFromIntError),
83 #[error(transparent)]
85 UTF8(#[from] std::str::Utf8Error),
86 #[error(transparent)]
88 FromUTF8(#[from] std::string::FromUtf8Error),
89 #[error(transparent)]
91 ParseInt(#[from] std::num::ParseIntError),
92 #[error(transparent)]
94 TableMetadataBuilder(
95 #[from] iceberg_rust_spec::spec::table_metadata::TableMetadataBuilderError,
96 ),
97 #[error(transparent)]
99 ViewMetadataBuilder(
100 #[from] iceberg_rust_spec::spec::view_metadata::GeneralViewMetadataBuilderError,
101 ),
102 #[error(transparent)]
104 VersionBuilder(#[from] iceberg_rust_spec::spec::view_metadata::VersionBuilderError),
105 #[error(transparent)]
107 CreateTableBuilder(#[from] crate::catalog::create::CreateTableBuilderError),
108 #[error(transparent)]
110 CreateViewBuilder(#[from] crate::catalog::create::CreateViewBuilderError),
111 #[error(transparent)]
113 CreateMaterializedViewBuilder(
114 #[from] crate::catalog::create::CreateMaterializedViewBuilderError,
115 ),
116}
117
118impl From<apache_avro::Error> for Error {
119 fn from(err: apache_avro::Error) -> Self {
120 Error::Avro(Box::new(err))
121 }
122}
123
124impl From<Error> for ArrowError {
125 fn from(value: Error) -> Self {
126 ArrowError::from_external_error(Box::new(value))
127 }
128}