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
#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("missing expected field `{0}`")]
	MissingField(String),
	#[error("HTTP error")]
	Reqwest(#[from] reqwest::Error),
	#[error("failed to execute task")]
	JoinError(#[from] tokio::task::JoinError),
	#[error("RSS error")]
	RSS(#[from] rss::Error),
	#[error("missing title")]
	MissingTitle,
	#[error("missing size")]
	MissingSize,
	#[error("missing link")]
	MissingLink,
	#[error("empty extension `{0}`")]
	EmptyExtension(String),
	#[error("failed to parse integer")]
	ParseInt(#[from] std::num::ParseIntError),
	#[error("failed to parse float")]
	ParseFloat(#[from] std::num::ParseFloatError),
	#[cfg(feature = "require-parse-names")]
	#[error("failed to parse torrent name: `{0}`")]
	ParseTorrentName(String)
}

#[cfg(feature = "require-parse-names")]
impl Error {
	pub fn parse_name_failure(name: &str) -> Self {
		Self::ParseTorrentName(name.to_string())
	}
}