Skip to main content

seyk_embed/
error.rs

1use std::path::PathBuf;
2
3/// Embedding errors, with no search or inference-runtime types.
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7    #[error("I/O error at {path}: {source}")]
8    Io {
9        path: PathBuf,
10        #[source]
11        source: std::io::Error,
12    },
13    #[error("embedding backend error: {0}")]
14    Embedding(String),
15    #[error("model files not found: {0}")]
16    ModelNotFound(String),
17    #[error("{modality} resources are not supported by this embedder")]
18    UnsupportedModality { modality: crate::Modality },
19    #[error("task {task:?} is not supported for {modality}")]
20    UnsupportedTask {
21        task: crate::EmbeddingTask,
22        modality: crate::Modality,
23    },
24    #[error("dimension mismatch: expected {expected}, got {actual}")]
25    DimensionMismatch { expected: usize, actual: usize },
26    #[error("invalid configuration: {0}")]
27    Config(String),
28}
29pub type Result<T, E = Error> = std::result::Result<T, E>;