1use crate::auth::Error;
2use ibdl_common::{
3 post::Post,
4 reqwest, serde_json,
5 tokio::{self, sync::mpsc::error::SendError},
6};
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum ExtractorError {
11 #[error("Failed to send post through channel")]
12 SyncChannelSendFail(#[from] std::sync::mpsc::SendError<Post>),
13
14 #[error("Failed to send post through channel")]
15 ChannelSendFail(#[from] SendError<Post>),
16
17 #[error("Too many tags, got: {current} while this imageboard only supports a max of {max}")]
18 TooManyTags { current: usize, max: u64 },
19
20 #[error("No posts found for tag selection")]
21 ZeroPosts,
22
23 #[error("Imageboard returned an invalid response")]
24 InvalidServerResponse,
25
26 #[error("Connection Error")]
27 ConnectionError(#[from] reqwest::Error),
28
29 #[error("Authentication failed. error: {source}")]
30 AuthenticationFailure {
31 #[from]
32 source: Error,
33 },
34
35 #[error("Error while deserializing JSON")]
36 JsonSerializeFail(#[from] serde_json::Error),
37
38 #[error("Error while reading Global blacklist file. error: {source}")]
39 BlacklistIOError {
40 #[from]
41 source: tokio::io::Error,
42 },
43
44 #[error("Failed to map posts")]
45 PostMapFailure,
46
47 #[error("Failed to decode blacklist.toml in {path}")]
48 BlacklistDecodeError { path: String },
49
50 #[error("Invalid imageboard selected for this extractor: {imgboard}")]
51 InvalidImageboard { imgboard: String },
52
53 #[error("Impossible execution path")]
54 ImpossibleBehavior,
55
56 #[error("Unsupported operation for this server")]
57 UnsupportedOperation,
58
59 #[error("Error sending length data to progress counter: {source}")]
60 SendLengthFail {
61 #[from]
62 source: SendError<u64>,
63 },
64}