1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum S3Error {
5 #[error("Utf8 decoding error: {0}")]
6 Utf8(#[from] std::str::Utf8Error),
7 #[error("Max expiration for presigned URLs is one week, or 604.800 seconds, got {0} instead")]
8 MaxExpiry(u32),
9 #[error("Got HTTP {0} with content '{1}'")]
10 Http(u16, String),
11 #[error("Http request returned a non 2** code")]
12 HttpFail,
13 #[error("aws-creds: {0}")]
14 Credentials(#[from] crate::creds::error::CredentialsError),
15 #[error("aws-region: {0}")]
16 Region(#[from] crate::region::error::RegionError),
17 #[error("sha2 invalid length: {0}")]
18 HmacInvalidLength(#[from] sha2::digest::InvalidLength),
19 #[error("url parse: {0}")]
20 UrlParse(#[from] url::ParseError),
21 #[error("io: {0}")]
22 Io(#[from] std::io::Error),
23 #[cfg(feature = "with-tokio")]
24 #[error("reqwest: {0}")]
25 Reqwest(#[from] reqwest::Error),
26 #[error("header to string: {0}")]
27 HeaderToStr(#[from] http::header::ToStrError),
28 #[error("from utf8: {0}")]
29 FromUtf8(#[from] std::string::FromUtf8Error),
30 #[error("serde xml: {0}")]
31 SerdeXml(#[from] quick_xml::de::DeError),
32 #[error("invalid header value: {0}")]
33 InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
34 #[error("invalid header name: {0}")]
35 InvalidHeaderName(#[from] http::header::InvalidHeaderName),
36 #[cfg(feature = "with-async-std")]
37 #[error("surf: {0}")]
38 Surf(String),
39 #[cfg(feature = "sync")]
40 #[error("attohttpc: {0}")]
41 Atto(#[from] attohttpc::Error),
42 #[error("Could not get Write lock on Credentials")]
43 WLCredentials,
44 #[error("Could not get Read lock on Credentials")]
45 RLCredentials,
46 #[error("Time format error: {0}")]
47 TimeFormatError(#[from] time::error::Format),
48 #[error("fmt error: {0}")]
49 FmtError(#[from] std::fmt::Error),
50}