use thiserror::Error;
use entelix_core::error::Error;
pub type PgVectorStoreResult<T> = std::result::Result<T, PgVectorStoreError>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum PgVectorStoreError {
#[error("postgres transport failure: {0}")]
Sqlx(#[from] sqlx::Error),
#[error("malformed row shape: {0}")]
Malformed(String),
#[error("configuration error: {0}")]
Config(String),
#[error("filter projection error: {0}")]
FilterProjection(String),
}
impl From<PgVectorStoreError> for Error {
fn from(err: PgVectorStoreError) -> Self {
match err {
PgVectorStoreError::Config(msg) | PgVectorStoreError::FilterProjection(msg) => {
Self::config(msg)
}
other => Self::provider_network_from(other),
}
}
}