use crate::config::error::ConfigError;
use crate::storage::error::StorageError;
use thiserror::Error;
pub type Result<T, E = CoreError> = std::result::Result<T, E>;
#[derive(Error, Debug)]
pub enum CoreError {
#[error(transparent)]
ArrowError(#[from] arrow::error::ArrowError),
#[error(transparent)]
AvroError(#[from] apache_avro::Error),
#[error("Config error: {0}")]
Config(#[from] ConfigError),
#[error("Commit metadata error: {0}")]
CommitMetadata(String),
#[error("{0}")]
MergeRecordError(String),
#[error("{0}")]
MemoryLimitExceeded(String),
#[error("Data type error: {0}")]
Schema(String),
#[error("{0}")]
SchemaNotFound(String),
#[error("File group error: {0}")]
FileGroup(String),
#[error("{0}")]
ReadFileSliceError(String),
#[error("{0}")]
LogFormatError(String),
#[error("{0}")]
LogBlockError(String),
#[error("HFile error: {0}")]
HFile(String),
#[error("Metadata table error: {0}")]
MetadataTable(String),
#[error("{0}")]
InvalidPartitionPath(String),
#[error("{0}")]
InvalidValue(String),
#[error(transparent)]
ParquetError(#[from] parquet::errors::ParquetError),
#[error("{0}")]
ReadLogFileError(#[from] std::io::Error),
#[error("Storage error: {0}")]
Storage(#[from] StorageError),
#[error("Timeline error: {0}")]
Timeline(String),
#[error("Timeline has no completed commit.")]
TimelineNoCommit,
#[error("{0}")]
TimestampParsingError(String),
#[error("{0}")]
Unsupported(String),
#[error(transparent)]
Utf8Error(#[from] std::str::Utf8Error),
}