ruvector_hyperbolic_hnsw/
error.rs1use thiserror::Error;
4
5#[derive(Error, Debug, Clone)]
7pub enum HyperbolicError {
8 #[error("Vector norm {norm} exceeds ball radius (1/sqrt(c) - eps) for curvature c={curvature}")]
10 OutsideBall { norm: f32, curvature: f32 },
11
12 #[error("Invalid curvature: {0}. Must be positive.")]
14 InvalidCurvature(f32),
15
16 #[error("Dimension mismatch: expected {expected}, got {got}")]
18 DimensionMismatch { expected: usize, got: usize },
19
20 #[error("Numerical instability: {0}")]
22 NumericalInstability(String),
23
24 #[error("Shard not found: {0}")]
26 ShardNotFound(String),
27
28 #[error("Index {index} out of bounds for size {size}")]
30 IndexOutOfBounds { index: usize, size: usize },
31
32 #[error("Cannot perform operation on empty collection")]
34 EmptyCollection,
35
36 #[error("Search failed: {0}")]
38 SearchFailed(String),
39}
40
41pub type HyperbolicResult<T> = Result<T, HyperbolicError>;