Skip to main content

entelix_memory_qdrant/
error.rs

1//! Local error type. Surfaces to callers as
2//! `entelix_core::Error::Provider` when crossing the public
3//! `VectorStore` boundary.
4
5use thiserror::Error;
6
7use entelix_core::error::Error;
8
9/// Result alias used inside `entelix-memory-qdrant`.
10pub type QdrantStoreResult<T> = std::result::Result<T, QdrantStoreError>;
11
12/// Errors that can surface from `QdrantVectorStore`.
13#[derive(Debug, Error)]
14#[non_exhaustive]
15pub enum QdrantStoreError {
16    /// gRPC / transport failure reaching the Qdrant server.
17    #[error("qdrant transport failure: {0}")]
18    Transport(#[from] qdrant_client::QdrantError),
19
20    /// Server returned a malformed or unexpected response shape.
21    #[error("malformed qdrant response: {0}")]
22    Malformed(String),
23
24    /// Configuration error — invalid URL, dimension mismatch at
25    /// build time, missing required collection name.
26    #[error("configuration error: {0}")]
27    Config(String),
28
29    /// `VectorFilter` carries a JSON value the qdrant projection
30    /// cannot represent (e.g. a non-numeric value supplied to a
31    /// `Range` filter). The audit suggests the operator-side
32    /// filter taxonomy or coerce the value before calling.
33    #[error("filter projection error: {0}")]
34    FilterProjection(String),
35}
36
37impl From<QdrantStoreError> for Error {
38    fn from(err: QdrantStoreError) -> Self {
39        match err {
40            QdrantStoreError::Config(msg) | QdrantStoreError::FilterProjection(msg) => {
41                Self::config(msg)
42            }
43            other => Self::provider_network_from(other),
44        }
45    }
46}