use icechunk::{
format::IcechunkFormatError, repository::RepositoryError, zarr::StoreError,
};
use pyo3::{exceptions::PyValueError, PyErr};
use thiserror::Error;
#[allow(clippy::enum_variant_names)]
#[derive(Debug, Error)]
pub(crate) enum PyIcechunkStoreError {
#[error("store error: {0}")]
StoreError(#[from] StoreError),
#[error("repository Error: {0}")]
RepositoryError(#[from] RepositoryError),
#[error("icechunk format error: {0}")]
IcechunkFormatError(#[from] IcechunkFormatError),
#[error("value error: {0}")]
PyValueError(#[from] PyValueError),
#[error("error: {0}")]
PyError(#[from] PyErr),
#[error("{0}")]
UnkownError(String),
}
impl From<PyIcechunkStoreError> for PyErr {
fn from(error: PyIcechunkStoreError) -> Self {
PyValueError::new_err(error.to_string())
}
}
pub(crate) type PyIcechunkStoreResult<T> = Result<T, PyIcechunkStoreError>;