Skip to main content

hermes_core/
error.rs

1//! Error types for minisearch
2
3use std::io;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    #[error("IO error: {0}")]
8    Io(#[from] io::Error),
9
10    #[error("Field not found: {0}")]
11    FieldNotFound(String),
12
13    #[error("Invalid field type: expected {expected}, got {got}")]
14    InvalidFieldType { expected: String, got: String },
15
16    #[error("Index corruption: {0}")]
17    Corruption(String),
18
19    #[error("Serialization error: {0}")]
20    Serialization(String),
21
22    #[error("Index is closed")]
23    IndexClosed,
24
25    #[error("Document not found: {0}")]
26    DocumentNotFound(u32),
27
28    #[error("Schema error: {0}")]
29    Schema(String),
30
31    #[error("Query error: {0}")]
32    Query(String),
33
34    #[error("Internal error: {0}")]
35    Internal(String),
36
37    #[error("Document error: {0}")]
38    Document(String),
39
40    #[error("Tokenizer error: {0}")]
41    Tokenizer(String),
42}
43
44pub type Result<T> = std::result::Result<T, Error>;