Skip to main content

chronix_engine/index/
error.rs

1//! Index error types.
2
3use thiserror::Error;
4
5/// Indexing errors.
6#[derive(Debug, Error)]
7pub enum IndexError {
8    /// Underlying I/O error.
9    #[error("Index I/O error: {0}")]
10    Io(#[from] std::io::Error),
11
12    /// Segment not found in the catalog.
13    #[error("Segment not found in catalog: {0}")]
14    SegmentNotFound(u64),
15
16    /// Corrupt index data.
17    #[error("Corrupt index: {detail}")]
18    Corrupt {
19        /// Description of the corruption.
20        detail: String,
21    },
22
23    /// Binary (postcard) serialization error.
24    #[error("Binary serialization error: {0}")]
25    BinarySerialization(String),
26
27    /// Manifest replay error.
28    #[error("Manifest error: {detail}")]
29    Manifest {
30        /// Description of the manifest error.
31        detail: String,
32    },
33}
34
35/// A specialized `Result` type for index operations.
36pub type Result<T> = std::result::Result<T, IndexError>;