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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
pub type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
    #[error("Incomplete download. Invalid chunk checksum.")]
    CacheChunkChecksum,

    #[error("Cache service responded with {0} during upload chunk.")]
    CacheChunkUpload(http::StatusCode),

    #[error(
        "Incomplete download. Expected chunk size: {expected_size}, actual chunk size: {actual_size}"
    )]
    CacheChunkDownload {
        expected_size: usize,
        actual_size: usize,
    },

    #[error("Cache service responded with {0} during commit cache.")]
    CacheCommit(http::StatusCode),

    #[error(
        "Incomplete download. Expected file size: {expected_size}, actual file size: {actual_size}"
    )]
    CacheDownload {
        expected_size: usize,
        actual_size: usize,
    },

    #[error("Cache not found.")]
    CacheNotFound,

    #[error("Cache service responded with {0}")]
    CacheServiceStatus(http::StatusCode),

    #[error("Cache size of {0} bytes is too large.")]
    CacheSize(usize),

    #[error(transparent)]
    InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),

    #[error("Key Validation Error: {0} cannot contain commas.")]
    InvalidKeyComma(String),

    #[error("Key Validation Error: {0} cannot be larger than 512 characters.")]
    InvalidKeyLength(String),

    #[error(transparent)]
    IO(#[from] std::io::Error),

    #[error(transparent)]
    Reqwest(#[from] reqwest::Error),

    #[error(transparent)]
    ReqwestMiddleware(#[from] reqwest_middleware::Error),

    #[error(transparent)]
    SerdeJson(#[from] serde_json::Error),

    #[error(transparent)]
    SerdeUrlencodedSerialize(#[from] serde_urlencoded::ser::Error),

    #[error(transparent)]
    UrlParse(#[from] url::ParseError),
}