Skip to main content

lb_tantivy/aggregation/
error.rs

1use common::ByteCount;
2
3use super::bucket::DateHistogramParseError;
4
5/// Error that may occur when opening a directory
6#[derive(Debug, Clone, PartialEq, Eq, Error)]
7pub enum AggregationError {
8    /// InternalError Aggregation Request
9    #[error("InternalError: {0:?}")]
10    InternalError(String),
11    /// Invalid Aggregation Request
12    #[error("InvalidRequest: {0:?}")]
13    InvalidRequest(String),
14    /// Date histogram parse error
15    #[error("Date histogram parse error: {0:?}")]
16    DateHistogramParseError(#[from] DateHistogramParseError),
17    /// Memory limit exceeded
18    #[error(
19        "Aborting aggregation because memory limit was exceeded. Limit: {limit:?}, Current: \
20         {current:?}"
21    )]
22    MemoryExceeded {
23        /// Memory consumption limit
24        limit: ByteCount,
25        /// Current memory consumption
26        current: ByteCount,
27    },
28    /// Bucket limit exceeded
29    #[error(
30        "Aborting aggregation because bucket limit was exceeded. Limit: {limit:?}, Current: \
31         {current:?}"
32    )]
33    BucketLimitExceeded {
34        /// Bucket limit
35        limit: u32,
36        /// Current num buckets
37        current: u32,
38    },
39}