1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum HiveGpuError {
8 #[error("Invalid dimension: expected {expected}, got {got}")]
10 InvalidDimension { expected: usize, got: usize },
11
12 #[error("Dimension mismatch: expected {expected}, got {actual}")]
14 DimensionMismatch { expected: usize, actual: usize },
15
16 #[error("VRAM limit exceeded: requested {requested}, limit {limit}")]
18 VramLimitExceeded { requested: usize, limit: usize },
19
20 #[error("GPU operation failed: {0}")]
22 GpuOperationFailed(String),
23
24 #[error("No GPU device available")]
26 NoDeviceAvailable,
27
28 #[error("Buffer allocation failed: {0}")]
30 BufferAllocationFailed(String),
31
32 #[error("Device initialization failed: {0}")]
34 DeviceInitializationFailed(String),
35
36 #[error("Shader compilation failed: {0}")]
38 ShaderCompilationFailed(String),
39
40 #[error("Memory allocation failed: {0}")]
42 MemoryAllocationFailed(String),
43
44 #[error("Search operation failed: {0}")]
46 SearchFailed(String),
47
48 #[error("Vector not found: {0}")]
50 VectorNotFound(String),
51
52 #[error("Invalid configuration: {0}")]
54 InvalidConfiguration(String),
55
56 #[error("Internal error: {0}")]
58 InternalError(String),
59
60 #[error("IO error: {0}")]
62 IoError(#[from] std::io::Error),
63
64 #[error("JSON error: {0}")]
66 JsonError(#[from] serde_json::Error),
67
68 #[error("{0}")]
70 Other(String),
71}
72
73pub type Result<T> = std::result::Result<T, HiveGpuError>;