Skip to main content

mail_query/
error.rs

1use thiserror::Error;
2
3/// Errors returned by [`parse`][crate::parse] and
4/// [`parse_with`][crate::parse_with].
5#[derive(Debug, Error, PartialEq, Eq)]
6#[non_exhaustive]
7pub enum ParseError {
8    #[error("unexpected end of input")]
9    UnexpectedEnd,
10    #[error("unexpected token: {0}")]
11    UnexpectedToken(String),
12    #[error("unmatched parenthesis")]
13    UnmatchedParen,
14    #[error("unmatched brace")]
15    UnmatchedBrace,
16    #[error("expected value after field")]
17    ExpectedValue,
18    /// A filter operator (`is:foo`, `has:bar`, `in:baz`) was used that
19    /// is neither in the built-in set nor registered via
20    /// [`ParserOptions::custom_filters`][crate::ParserOptions].
21    #[error("unknown filter: {0}")]
22    UnknownFilter(String),
23    #[error("invalid size: {0}")]
24    InvalidSize(String),
25    #[error("invalid date: {0}")]
26    InvalidDate(String),
27}