1use thiserror::Error;
2
3#[derive(Error, Debug)]
4#[non_exhaustive]
5pub enum S3Error {
6 #[error("Utf8 decoding error: {0}")]
7 Utf8(#[from] std::str::Utf8Error),
8 #[error("Max expiration for presigned URLs is one week, or 604.800 seconds, got {0} instead")]
9 MaxExpiry(u32),
10 #[error("Got HTTP {0} with content '{1}'")]
11 HttpFailWithBody(u16, String),
12 #[error("Http request returned a non 2** code")]
13 HttpFail,
14 #[error("invalid multipart uploads pagination: {0}")]
15 InvalidMultipartUploadsPagination(&'static str),
16 #[error("header '{0}' cannot be applied to a streamed multipart upload")]
17 UnsupportedMultipartHeader(http::header::HeaderName),
18 #[error("aws-creds: {0}")]
19 Credentials(#[from] crate::creds::error::CredentialsError),
20 #[error("aws-region: {0}")]
21 Region(#[from] crate::region::error::RegionError),
22 #[error("sha2 invalid length: {0}")]
23 HmacInvalidLength(#[from] sha2::digest::InvalidLength),
24 #[error("url parse: {0}")]
25 UrlParse(#[from] url::ParseError),
26 #[error("io: {0}")]
27 Io(#[from] std::io::Error),
28 #[cfg(feature = "with-tokio")]
29 #[error("http: {0}")]
30 Http(#[from] http::Error),
31 #[cfg(feature = "with-tokio")]
32 #[error("reqwest: {0}")]
33 Reqwest(#[from] reqwest::Error),
34 #[cfg(feature = "with-tokio")]
35 #[error("reqwest: {0}")]
36 ReqwestHeaderToStr(#[from] reqwest::header::ToStrError),
37 #[cfg(feature = "with-async-std")]
38 #[error("header to string: {0}")]
39 HeaderToStr(#[from] http::header::ToStrError),
40 #[error("from utf8: {0}")]
41 FromUtf8(#[from] std::string::FromUtf8Error),
42 #[error("serde xml: {0}")]
43 SerdeXml(#[from] quick_xml::de::DeError),
44 #[error("invalid header value: {0}")]
45 InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
46 #[cfg(any(feature = "with-async-std", feature = "with-tokio"))]
47 #[error("invalid header name: {0}")]
48 InvalidHeaderName(#[from] http::header::InvalidHeaderName),
49 #[cfg(feature = "with-async-std")]
50 #[error("surf: {0}")]
51 Surf(String),
52 #[cfg(feature = "sync")]
53 #[error("attohttpc: {0}")]
54 Atto(#[from] attohttpc::Error),
55 #[cfg(feature = "sync")]
56 #[error("attohttpc: {0}")]
57 AttoHeader(#[from] attohttpc::header::ToStrError),
58 #[cfg(feature = "sync")]
59 #[error("attohttpc: {0}")]
60 AttoHeaderName(#[from] attohttpc::header::InvalidHeaderName),
61 #[error("Could not get Write lock on Credentials")]
62 WLCredentials,
63 #[error("Could not get Read lock on Credentials")]
64 RLCredentials,
65 #[error("Time format error: {0}")]
66 TimeFormatError(#[from] time::error::Format),
67 #[error("fmt error: {0}")]
68 FmtError(#[from] std::fmt::Error),
69 #[error("serde error: {0}")]
70 SerdeError(#[from] serde_json::Error),
71 #[error("post policy error: {0}")]
72 PostPolicyError(#[from] crate::post_policy::PostPolicyError),
73 #[error("Could not get read lock on credentials")]
74 CredentialsReadLock,
75 #[error("Could not get write lock on credentials")]
76 CredentialsWriteLock,
77 #[error("xml serialization error: {0}")]
78 XmlSeError(#[from] quick_xml::SeError),
79}