1use thiserror::Error;
2
3pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
4
5#[derive(Error, Debug)]
7pub enum BM25Error {
8 #[error("BM25 index {name:?}, error: {source:?}")]
10 Generic { name: String, source: BoxError },
11
12 #[error("BM25 index {name:?}, CBOR serialization error: {source:?}")]
14 Serialization { name: String, source: BoxError },
15
16 #[error("BM25 index {name:?}, token not found: {token:?}")]
18 NotFound { name: String, token: String },
19
20 #[error("BM25 index {name:?}, segment {id} already exists")]
22 AlreadyExists { name: String, id: u64 },
23
24 #[error("BM25 index {name:?}, segment {id} tokenization failed: {text:?}")]
26 TokenizeFailed { name: String, id: u64, text: String },
27}