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 /// Metal GPU backend error.
13 #[error("Metal: {0}")]
14 Metal(String),
15
16 /// CPU backend error.
17 #[error("CPU: {0}")]
18 Cpu(String),
19
20 /// Tokenization of input text failed.
21 #[error("tokenization failed: {0}")]
22 Tokenization(String),
23
24 /// File I/O error with path context.
25 #[error("I/O error: {path}")]
26 Io {
27 /// Path that caused the error.
28 path: String,
29 /// Underlying I/O error.
30 #[source]
31 source: std::io::Error,
32 },
33
34 /// Unsupported source file language.
35 #[error("unsupported language: {0}")]
36 UnsupportedLanguage(String),
37
38 /// Catch-all for other errors.
39 #[error(transparent)]
40 Other(#[from] anyhow::Error),
41}