1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ClientError {
5 #[error("Initialize Error")]
6 Initialize(String),
7 #[error("Token expired, Need Authentication")]
8 NeedAuthentication,
9 #[error("Authentication Failed")]
10 Authentication,
11 #[error("url parse failed")]
12 UrlParse(#[from] url::ParseError),
13 #[error("Invalid Headers")]
14 InvalidHeaders(#[from] reqwest::header::InvalidHeaderValue),
15 #[error("Invalid Multipart: {0}")]
16 InvalidMultipart(String),
17 #[error("Send Request Error")]
18 ReqwestError(#[from] reqwest::Error),
19 #[error("Parse Error")]
20 ParseError,
21
22 #[error("Torrents with hashes ({hash}) Not Found.")]
23 TorrentNotFound { hash: String },
24 #[error("Torrent File under {path} is invalid.")]
25 TorrentFileInvalid { path: String },
26 #[error("Search Job {id} Not Found.")]
27 SearchJobNotFound { id: u64 },
28 #[error("Bad Request: {0}")]
29 BadRequest(String),
30 #[error("Conflict: {0}")]
31 Conflict(String),
32 #[error("Error: {0}")]
33 Other(String),
34 #[error("Unknown Error")]
35 Unknown,
36}
37
38#[derive(Error, Debug)]
39pub enum TypesError {
40 #[error("Error: {0}")]
41 Other(String),
42}