use feed_rs::parser; use thiserror::Error; use url::Url; #[derive(Debug, Error)] pub enum Error { #[error("error pulling feed `{0}`: {1}")] Pull(Url, PullError), #[error("error parsing entry: {0}")] Entry(#[from] EntryError), #[error("error adding feed: {0}")] Add(#[from] AddError), } #[derive(Debug, Error)] pub enum PullError { #[error("failed to make request")] Request(#[from] reqwest::Error), #[error("invalid rss feed: {0}")] Parse(#[from] parser::ParseFeedError), #[error("failed to pull feed title")] TitleUpdate, #[error("failed to pull feed link")] LinkUpdate, } #[derive(Debug, Error, Copy, Clone)] pub enum EntryError { #[error("missing title")] MissingTitle, #[error("missing link")] MissingLink, #[error("invalid link")] InvalidLink, #[error("missing publish-date")] MissingPubDate, } #[derive(Debug, Error)] pub enum AddError { #[error("invalid url: {0}")] InvalidUrl(String), #[error("feed is already present")] DuplicateLink, } #[derive(Debug, Error)] pub enum IOError { #[error("unable to create or find store path")] MissingStorePath, #[error("file error:")] FileIO(#[from] std::io::Error), #[error("yaml ser/de error")] Serde(#[from] serde_yaml::Error), }