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("{0} not found.")]
25 NotFound(String),
26 #[error("Feature {0} is not supported.")]
28 NotSupported(String),
29 #[error("Entity not found in catalog")]
31 CatalogNotFound,
32 #[error(transparent)]
34 External(Box<dyn std::error::Error + Send + Sync>),
35 #[error(transparent)]
37 Iceberg(#[from] iceberg_rust_spec::error::Error),
38 #[error(transparent)]
40 Arrow(#[from] arrow::error::ArrowError),
41 #[error(transparent)]
43 Parquet(#[from] parquet::errors::ParquetError),
44 #[error(transparent)]
46 Avro(#[from] apache_avro::Error),
47 #[error(transparent)]
49 Thrift(#[from] thrift::Error),
50 #[error(transparent)]
52 SQLParser(#[from] sqlparser::parser::ParserError),
53 #[error(transparent)]
55 JSONSerde(#[from] serde_json::Error),
56 #[error(transparent)]
58 Uuid(#[from] uuid::Error),
59 #[error(transparent)]
61 Url(#[from] url::ParseError),
62 #[error(transparent)]
64 IO(#[from] std::io::Error),
65 #[error(transparent)]
67 FuturesChannel(#[from] futures::channel::mpsc::SendError),
68 #[error(transparent)]
70 TokioJoinError(#[from] tokio::task::JoinError),
71 #[error(transparent)]
73 ObjectStore(#[from] object_store::Error),
74 #[error(transparent)]
76 TryFromSlice(#[from] std::array::TryFromSliceError),
77 #[error(transparent)]
79 TryFromInt(#[from] std::num::TryFromIntError),
80 #[error(transparent)]
82 UTF8(#[from] std::str::Utf8Error),
83 #[error(transparent)]
85 FromUTF8(#[from] std::string::FromUtf8Error),
86 #[error(transparent)]
88 ParseInt(#[from] std::num::ParseIntError),
89 #[error(transparent)]
91 TableMetadataBuilder(
92 #[from] iceberg_rust_spec::spec::table_metadata::TableMetadataBuilderError,
93 ),
94 #[error(transparent)]
96 ViewMetadataBuilder(
97 #[from] iceberg_rust_spec::spec::view_metadata::GeneralViewMetadataBuilderError,
98 ),
99 #[error(transparent)]
101 VersionBuilder(#[from] iceberg_rust_spec::spec::view_metadata::VersionBuilderError),
102 #[error(transparent)]
104 CreateTableBuilder(#[from] crate::catalog::create::CreateTableBuilderError),
105 #[error(transparent)]
107 CreateViewBuilder(#[from] crate::catalog::create::CreateViewBuilderError),
108 #[error(transparent)]
110 CreateMaterializedViewBuilder(
111 #[from] crate::catalog::create::CreateMaterializedViewBuilderError,
112 ),
113}
114
115impl From<Error> for ArrowError {
116 fn from(value: Error) -> Self {
117 ArrowError::from_external_error(Box::new(value))
118 }
119}