Skip to main content

common/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum DakeraError {
5    #[error("Namespace not found: {0}")]
6    NamespaceNotFound(String),
7
8    #[error("Vector not found: {0}")]
9    VectorNotFound(String),
10
11    #[error("Invalid dimension: expected {expected}, got {actual}")]
12    DimensionMismatch { expected: usize, actual: usize },
13
14    #[error("Empty vector")]
15    EmptyVector,
16
17    #[error("Storage error: {0}")]
18    Storage(String),
19
20    #[error("Invalid request: {0}")]
21    InvalidRequest(String),
22
23    #[error("Quota exceeded for namespace '{namespace}': {reason}")]
24    QuotaExceeded { namespace: String, reason: String },
25
26    #[error("Service unavailable: {0}")]
27    ServiceUnavailable(String),
28}
29
30pub type Result<T> = std::result::Result<T, DakeraError>;