Skip to main content

journal_index/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during journal indexing operations.
4#[derive(Error, Debug)]
5pub enum IndexError {
6    /// Bucket duration cannot be zero
7    #[error("bucket duration must not be zero")]
8    ZeroBucketDuration,
9
10    /// Cannot create a histogram from empty input
11    #[error("cannot create histogram from empty input")]
12    EmptyHistogramInput,
13
14    /// Invalid query time range
15    #[error("invalid query time range")]
16    InvalidQueryTimeRange,
17
18    /// Invalid regex pattern
19    #[error("invalid regex pattern:")]
20    InvalidRegex,
21
22    /// Data payload does not contain this field prefix
23    #[error("invalid field prefix")]
24    InvalidFieldPrefix,
25
26    /// Field value not utf8
27    #[error("non-utf8 payload")]
28    NonUtf8Payload,
29
30    /// Field value can not be parsed as integer
31    #[error("non-integer payload")]
32    NonIntegerPayload,
33
34    /// Log entry does not have this field
35    #[error("missing field name")]
36    MissingFieldName,
37
38    /// Missing required offset in journal file
39    #[error("missing required offset in journal file")]
40    MissingOffset,
41
42    /// Underlying journal file error
43    #[error("journal error: {0}")]
44    Journal(#[from] journal_core::error::JournalError),
45}
46
47static_assertions::const_assert!(std::mem::size_of::<IndexError>() <= 32);
48
49pub type Result<T> = std::result::Result<T, IndexError>;