1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
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),
}
|