s3_simple/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum S3Error {
5    #[error("credentials: {0}")]
6    Credentials(String),
7    #[error("env var missing: {0}")]
8    EnvVarMissing(#[from] std::env::VarError),
9    #[error("fmt error: {0}")]
10    FmtError(#[from] std::fmt::Error),
11    #[error("from utf8: {0}")]
12    FromUtf8(#[from] std::string::FromUtf8Error),
13    #[error("header to string: {0}")]
14    HeaderToStr(#[from] http::header::ToStrError),
15    #[error("sha2 invalid length: {0}")]
16    HmacInvalidLength(#[from] sha2::digest::InvalidLength),
17    #[error("S3_HOST must have a domain and not IP: '{0}'")]
18    HostDomain(&'static str),
19    #[error("Http request returned a non 2** code")]
20    HttpFail,
21    #[error("Got HTTP {0} with content '{1}'")]
22    HttpFailWithBody(u16, String),
23    #[error("io: {0}")]
24    Io(#[from] std::io::Error),
25    #[error("http: {0}")]
26    Http(#[from] http::Error),
27    #[error("invalid header name: {0}")]
28    InvalidHeaderName(#[from] http::header::InvalidHeaderName),
29    #[error("invalid header value: {0}")]
30    InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
31    #[error("tokio task join: {0}")]
32    Join(#[from] tokio::task::JoinError),
33    #[error("invalid range: {0}")]
34    Range(&'static str),
35    #[error("request: {0}")]
36    Reqwest(#[from] reqwest::Error),
37    #[error("serde xml: {0}")]
38    SerdeXml(#[from] quick_xml::de::DeError),
39    #[error("Time format error: {0}")]
40    TimeFormatError(#[from] time::error::Format),
41    #[error("url parse: {0}")]
42    UrlParse(#[from] url::ParseError),
43    #[error("Utf8 decoding error: {0}")]
44    Utf8(#[from] std::str::Utf8Error),
45    #[error("Unexpected response: {0}")]
46    UnexpectedResponse(&'static str),
47}