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 HttpFailWithBody(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 #[error("http: {0}")]
24 Http(#[from] http::Error),
25 #[error("hyper: {0}")]
26 Hyper(#[from] hyper::Error),
27 #[error("header to string: {0}")]
28 HeaderToStr(#[from] http::header::ToStrError),
29 #[error("from utf8: {0}")]
30 FromUtf8(#[from] std::string::FromUtf8Error),
31 #[error("serde xml: {0}")]
32 SerdeXml(#[from] quick_xml::de::DeError),
33 #[error("invalid header value: {0}")]
34 InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
35 #[error("invalid header name: {0}")]
36 InvalidHeaderName(#[from] http::header::InvalidHeaderName),
37 #[error("Could not get Write lock on Credentials")]
38 WLCredentials,
39 #[error("Could not get Read lock on Credentials")]
40 RLCredentials,
41 #[error("Time format error: {0}")]
42 TimeFormatError(#[from] time::error::Format),
43 #[error("fmt error: {0}")]
44 FmtError(#[from] std::fmt::Error),
45}