ripvec_core/error.rs
1//! Error types for ripvec-core.
2
3use thiserror::Error;
4
5/// Errors that can occur in ripvec-core operations.
6#[derive(Error, Debug)]
7pub enum Error {
8 /// Model download or cache retrieval failed.
9 #[error("model download failed: {0}")]
10 Download(String),
11
12 /// CUDA backend error.
13 #[error("CUDA error: {0}")]
14 Cuda(String),
15
16 /// Metal GPU backend error.
17 #[error("Metal: {0}")]
18 Metal(String),
19
20 /// CPU backend error.
21 #[error("CPU: {0}")]
22 Cpu(String),
23
24 /// Tokenization of input text failed.
25 #[error("tokenization failed: {0}")]
26 Tokenization(String),
27
28 /// File I/O error with path context.
29 #[error("I/O error: {path}")]
30 Io {
31 /// Path that caused the error.
32 path: String,
33 /// Underlying I/O error.
34 #[source]
35 source: std::io::Error,
36 },
37
38 /// Unsupported source file language.
39 #[error("unsupported language: {0}")]
40 UnsupportedLanguage(String),
41
42 /// Catch-all for other errors.
43 #[error(transparent)]
44 Other(#[from] anyhow::Error),
45}