imessage_database/error/query_context.rs
1/*!
2 Errors that can happen when parsing query context data.
3*/
4
5use std::fmt::{Display, Formatter, Result};
6
7/// Errors that can happen when parsing query context data
8#[derive(Debug)]
9pub enum QueryContextError {
10 /// Error that occurs when a date string cannot be parsed into a valid date
11 InvalidDate(String),
12}
13
14impl Display for QueryContextError {
15 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
16 match self {
17 QueryContextError::InvalidDate(date) => write!(
18 fmt,
19 "Invalid date provided: {date}! Must be in format YYYY-MM-DD."
20 ),
21 }
22 }
23}