ibdl_common/post/
error.rs1use std::{io, num::TryFromIntError};
2
3use thiserror::Error;
4use tokio::task;
5
6#[derive(Error, Debug)]
7pub enum PostError {
8 #[error("This file was already correctly downloaded")]
9 CorrectFileExists,
10
11 #[error("Failed to access file: {source}")]
12 FileIOError {
13 #[from]
14 source: io::Error,
15 },
16
17 #[error("Failed to print line to Progress Bar: {message}")]
18 ProgressBarPrintFail { message: String },
19
20 #[error("Failed to connect to download URL: {source}")]
21 ConnectionFail {
22 #[from]
23 source: reqwest::Error,
24 },
25
26 #[error("Post URL is valid but original file doesn't exist")]
27 RemoteFileNotFound,
28
29 #[error("Error while fetching chunk: {message}")]
30 ChunkDownloadFail { message: String },
31
32 #[error("Failed to start thread for writing file to destination cbz: {source}")]
33 ZipThreadStartError {
34 #[from]
35 source: task::JoinError,
36 },
37
38 #[error("Failed to write file to destination cbz: {message}")]
39 ZipFileWriteError { message: String },
40
41 #[error("Int conversion failed (maybe size is too large?)")]
42 IntConversion(#[from] TryFromIntError),
43
44 #[error("Post has an unknown extension: {message}")]
45 UnknownExtension { message: String },
46}