sieve_kit/error.rs
1//! Error type for filter rule construction and validation.
2
3use thiserror::Error as ThisError;
4
5/// Errors produced when constructing or validating filter rules.
6#[derive(Debug, ThisError)]
7pub enum FilterError {
8 /// A `Condition` with [`Operator::Regex`](crate::types::Operator::Regex)
9 /// carries a pattern that does not compile.
10 #[error("invalid regex pattern {pattern:?}")]
11 InvalidRegex {
12 /// The offending pattern.
13 pattern: String,
14 /// The underlying regex parse error.
15 #[source]
16 source: regex::Error,
17 },
18 /// The rule's `id` field is empty.
19 #[error("rule id must not be empty")]
20 EmptyRuleId,
21 /// The rule's `name` field is empty.
22 #[error("rule name must not be empty")]
23 EmptyRuleName,
24}