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
use std::num::ParseIntError;
use thiserror::Error;
use tokio::io;
#[derive(Debug, Error)]
pub enum Error {
#[error("Failed to parse content-length")]
LenParse(#[from] ParseIntError),
#[error("Failed to retrieve content-length")]
NoLen,
#[error("Tokio IO error: {0}")]
TokioIOError(#[from] io::Error),
#[error("Reqwest error: {0}")]
NetError(#[from] reqwest::Error),
#[error(transparent)]
ToStr(#[from] reqwest::header::ToStrError),
#[error("No filename in url")]
NoFilename(String),
#[error("Failed to parse URL")]
UrlParseError(#[from] url::ParseError),
#[error("Checksum doesn't match")]
SHA256MisMatch(String),
#[error("Invalid chunk size")]
BadChunkSize,
}
pub type Result<T> = std::result::Result<T, Error>;