1use std::fmt;
4
5pub type QdrantResult<T> = Result<T, QdrantError>;
7
8#[derive(Debug)]
10pub enum QdrantError {
11 Connection(String),
13 Grpc(String),
15 CollectionNotFound(String),
17 PointNotFound(String),
19 DimensionMismatch { expected: usize, got: usize },
21 Encode(String),
23 Decode(String),
25 Timeout,
27}
28
29impl fmt::Display for QdrantError {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 QdrantError::Connection(msg) => write!(f, "Connection error: {}", msg),
33 QdrantError::Grpc(msg) => write!(f, "gRPC error: {}", msg),
34 QdrantError::CollectionNotFound(name) => write!(f, "Collection not found: {}", name),
35 QdrantError::PointNotFound(id) => write!(f, "Point not found: {}", id),
36 QdrantError::DimensionMismatch { expected, got } => {
37 write!(f, "Vector dimension mismatch: expected {}, got {}", expected, got)
38 }
39 QdrantError::Encode(msg) => write!(f, "Encode error: {}", msg),
40 QdrantError::Decode(msg) => write!(f, "Decode error: {}", msg),
41 QdrantError::Timeout => write!(f, "Operation timed out"),
42 }
43 }
44}
45
46impl std::error::Error for QdrantError {}