imdb_async/
error.rs

1use indexkv::StreamError;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5	#[error("year missing")]
6	YearMissing,
7	#[error("season missing")]
8	SeasonMissing,
9	#[error("episode missing")]
10	EpisodeMissing,
11	#[error("wrong media type {0} for {1}")]
12	WrongMediaType(&'static str, &'static str),
13	#[error("HTTP error:  {0}")]
14	HTTP(#[from] reqwest::Error),
15	#[error("CSV error:  {0}")]
16	CSV(#[from] csv_async::Error),
17	#[error("I/O error:  {0}")]
18	IO(#[from] std::io::Error),
19	#[error("failed to do math on system times:  {0}")]
20	SystemTime(#[from] std::time::SystemTimeError),
21	#[error("title ID {0} not found")]
22	NotFound(u32),
23	#[error("cache failure:  {0}")]
24	Cache(#[from] indexkv::Error<u32>),
25	#[error("invalid genre {0}")]
26	InvalidGenre(String)
27}
28
29impl From<StreamError<Error, u32>> for Error {
30	fn from(other: StreamError<Error, u32>) -> Self {
31		match other {
32			StreamError::Internal(e) => Self::from(e),
33			StreamError::Caller(e) => e
34		}
35	}
36}
37