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
use indexkv::StreamError;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("year missing")]
YearMissing,
#[error("season missing")]
SeasonMissing,
#[error("episode missing")]
EpisodeMissing,
#[error("wrong media type {0} for {1}")]
WrongMediaType(&'static str, &'static str),
#[error("HTTP error")]
HTTP(#[from] reqwest::Error),
#[error("CSV error")]
CSV(#[from] csv_async::Error),
#[error("I/O error")]
IO(#[from] std::io::Error),
#[error("failed to do math on system times")]
SystemTime(#[from] std::time::SystemTimeError),
#[error("title ID {0} not found")]
NotFound(u32),
#[error("cache failure")]
Cache(#[from] indexkv::Error<u32>),
#[error("invalid genre {0}")]
InvalidGenre(String)
}
impl From<StreamError<Error, u32>> for Error {
fn from(other: StreamError<Error, u32>) -> Self {
match other {
StreamError::Internal(e) => Self::from(e),
StreamError::Caller(e) => e
}
}
}