Skip to main content

caldir_core/calendar/event/
error.rs

1use std::path::PathBuf;
2
3use crate::event::EventError;
4
5#[derive(Debug, thiserror::Error)]
6#[non_exhaustive]
7pub enum CalendarEventError {
8    #[error("failed to read event file {0}")]
9    Read(PathBuf, #[source] std::io::Error),
10
11    #[error("failed to delete event file {0}")]
12    Delete(PathBuf, #[source] std::io::Error),
13
14    #[error("invalid event in ICS file {0}")]
15    InvalidEvent(PathBuf, #[source] EventError),
16
17    #[error("expected exactly one event in {path}, found {found}")]
18    ExpectedSingleEvent { path: PathBuf, found: usize },
19
20    #[error(transparent)]
21    Io(#[from] std::io::Error),
22
23    #[error("event file not found: {0}")]
24    NotFound(PathBuf),
25
26    #[error(transparent)]
27    Event(#[from] EventError),
28
29    #[error("event {0} is not a recurring master")]
30    NotRecurring(String),
31}