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 std::error::Error for QueryContextError {}
15
16impl Display for QueryContextError {
17 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
18 match self {
19 QueryContextError::InvalidDate(date) => write!(
20 fmt,
21 "Invalid date provided: {date}! Must be in format YYYY-MM-DD."
22 ),
23 }
24 }
25}