1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 #[allow(missing_docs)] AccessDeniedException(crate::types::error::AccessDeniedException),
8 DataAlreadyExistsException(crate::types::error::DataAlreadyExistsException),
10 IllegalArgumentException(crate::types::error::IllegalArgumentException),
12 KmsInvalidKeyUsageException(crate::types::error::KmsInvalidKeyUsageException),
14 NotReadableInputStreamException(crate::types::error::NotReadableInputStreamException),
16 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
18 RetryableException(crate::types::error::RetryableException),
20 ServiceInternalException(crate::types::error::ServiceInternalException),
22 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
24 ThrottlingException(crate::types::error::ThrottlingException),
26 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
28 variable wildcard pattern and check `.code()`:
29 \
30 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
31 \
32 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
33 Unhandled(crate::error::sealed_unhandled::Unhandled),
34}
35impl ::std::fmt::Display for Error {
36 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37 match self {
38 Error::AccessDeniedException(inner) => inner.fmt(f),
39 Error::DataAlreadyExistsException(inner) => inner.fmt(f),
40 Error::IllegalArgumentException(inner) => inner.fmt(f),
41 Error::KmsInvalidKeyUsageException(inner) => inner.fmt(f),
42 Error::NotReadableInputStreamException(inner) => inner.fmt(f),
43 Error::ResourceNotFoundException(inner) => inner.fmt(f),
44 Error::RetryableException(inner) => inner.fmt(f),
45 Error::ServiceInternalException(inner) => inner.fmt(f),
46 Error::ServiceUnavailableException(inner) => inner.fmt(f),
47 Error::ThrottlingException(inner) => inner.fmt(f),
48 Error::Unhandled(_) => {
49 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
50 write!(f, "unhandled error ({code})")
51 } else {
52 f.write_str("unhandled error")
53 }
54 }
55 }
56 }
57}
58impl From<::aws_smithy_types::error::operation::BuildError> for Error {
59 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
60 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
61 source: value.into(),
62 meta: ::std::default::Default::default(),
63 })
64 }
65}
66impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
67 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
68 match self {
69 Self::AccessDeniedException(inner) => inner.meta(),
70 Self::DataAlreadyExistsException(inner) => inner.meta(),
71 Self::IllegalArgumentException(inner) => inner.meta(),
72 Self::KmsInvalidKeyUsageException(inner) => inner.meta(),
73 Self::NotReadableInputStreamException(inner) => inner.meta(),
74 Self::ResourceNotFoundException(inner) => inner.meta(),
75 Self::RetryableException(inner) => inner.meta(),
76 Self::ServiceInternalException(inner) => inner.meta(),
77 Self::ServiceUnavailableException(inner) => inner.meta(),
78 Self::ThrottlingException(inner) => inner.meta(),
79 Self::Unhandled(inner) => &inner.meta,
80 }
81 }
82}
83impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_object::DeleteObjectError, R>> for Error
84where
85 R: Send + Sync + std::fmt::Debug + 'static,
86{
87 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_object::DeleteObjectError, R>) -> Self {
88 match err {
89 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
90 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
91 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
92 source: err.into(),
93 }),
94 }
95 }
96}
97impl From<crate::operation::delete_object::DeleteObjectError> for Error {
98 fn from(err: crate::operation::delete_object::DeleteObjectError) -> Self {
99 match err {
100 crate::operation::delete_object::DeleteObjectError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
101 crate::operation::delete_object::DeleteObjectError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
102 crate::operation::delete_object::DeleteObjectError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
103 crate::operation::delete_object::DeleteObjectError::RetryableException(inner) => Error::RetryableException(inner),
104 crate::operation::delete_object::DeleteObjectError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
105 crate::operation::delete_object::DeleteObjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
106 crate::operation::delete_object::DeleteObjectError::ThrottlingException(inner) => Error::ThrottlingException(inner),
107 crate::operation::delete_object::DeleteObjectError::Unhandled(inner) => Error::Unhandled(inner),
108 }
109 }
110}
111impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_chunk::GetChunkError, R>> for Error
112where
113 R: Send + Sync + std::fmt::Debug + 'static,
114{
115 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_chunk::GetChunkError, R>) -> Self {
116 match err {
117 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
118 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
119 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
120 source: err.into(),
121 }),
122 }
123 }
124}
125impl From<crate::operation::get_chunk::GetChunkError> for Error {
126 fn from(err: crate::operation::get_chunk::GetChunkError) -> Self {
127 match err {
128 crate::operation::get_chunk::GetChunkError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
129 crate::operation::get_chunk::GetChunkError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
130 crate::operation::get_chunk::GetChunkError::KmsInvalidKeyUsageException(inner) => Error::KmsInvalidKeyUsageException(inner),
131 crate::operation::get_chunk::GetChunkError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
132 crate::operation::get_chunk::GetChunkError::RetryableException(inner) => Error::RetryableException(inner),
133 crate::operation::get_chunk::GetChunkError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
134 crate::operation::get_chunk::GetChunkError::ThrottlingException(inner) => Error::ThrottlingException(inner),
135 crate::operation::get_chunk::GetChunkError::Unhandled(inner) => Error::Unhandled(inner),
136 }
137 }
138}
139impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_object_metadata::GetObjectMetadataError, R>> for Error
140where
141 R: Send + Sync + std::fmt::Debug + 'static,
142{
143 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_object_metadata::GetObjectMetadataError, R>) -> Self {
144 match err {
145 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
146 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
147 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
148 source: err.into(),
149 }),
150 }
151 }
152}
153impl From<crate::operation::get_object_metadata::GetObjectMetadataError> for Error {
154 fn from(err: crate::operation::get_object_metadata::GetObjectMetadataError) -> Self {
155 match err {
156 crate::operation::get_object_metadata::GetObjectMetadataError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
157 crate::operation::get_object_metadata::GetObjectMetadataError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
158 crate::operation::get_object_metadata::GetObjectMetadataError::KmsInvalidKeyUsageException(inner) => {
159 Error::KmsInvalidKeyUsageException(inner)
160 }
161 crate::operation::get_object_metadata::GetObjectMetadataError::ResourceNotFoundException(inner) => {
162 Error::ResourceNotFoundException(inner)
163 }
164 crate::operation::get_object_metadata::GetObjectMetadataError::RetryableException(inner) => Error::RetryableException(inner),
165 crate::operation::get_object_metadata::GetObjectMetadataError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
166 crate::operation::get_object_metadata::GetObjectMetadataError::ServiceUnavailableException(inner) => {
167 Error::ServiceUnavailableException(inner)
168 }
169 crate::operation::get_object_metadata::GetObjectMetadataError::ThrottlingException(inner) => Error::ThrottlingException(inner),
170 crate::operation::get_object_metadata::GetObjectMetadataError::Unhandled(inner) => Error::Unhandled(inner),
171 }
172 }
173}
174impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_chunks::ListChunksError, R>> for Error
175where
176 R: Send + Sync + std::fmt::Debug + 'static,
177{
178 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_chunks::ListChunksError, R>) -> Self {
179 match err {
180 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
181 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
182 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
183 source: err.into(),
184 }),
185 }
186 }
187}
188impl From<crate::operation::list_chunks::ListChunksError> for Error {
189 fn from(err: crate::operation::list_chunks::ListChunksError) -> Self {
190 match err {
191 crate::operation::list_chunks::ListChunksError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
192 crate::operation::list_chunks::ListChunksError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
193 crate::operation::list_chunks::ListChunksError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
194 crate::operation::list_chunks::ListChunksError::RetryableException(inner) => Error::RetryableException(inner),
195 crate::operation::list_chunks::ListChunksError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
196 crate::operation::list_chunks::ListChunksError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
197 crate::operation::list_chunks::ListChunksError::Unhandled(inner) => Error::Unhandled(inner),
198 }
199 }
200}
201impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_objects::ListObjectsError, R>> for Error
202where
203 R: Send + Sync + std::fmt::Debug + 'static,
204{
205 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_objects::ListObjectsError, R>) -> Self {
206 match err {
207 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
208 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
209 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
210 source: err.into(),
211 }),
212 }
213 }
214}
215impl From<crate::operation::list_objects::ListObjectsError> for Error {
216 fn from(err: crate::operation::list_objects::ListObjectsError) -> Self {
217 match err {
218 crate::operation::list_objects::ListObjectsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
219 crate::operation::list_objects::ListObjectsError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
220 crate::operation::list_objects::ListObjectsError::KmsInvalidKeyUsageException(inner) => Error::KmsInvalidKeyUsageException(inner),
221 crate::operation::list_objects::ListObjectsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
222 crate::operation::list_objects::ListObjectsError::RetryableException(inner) => Error::RetryableException(inner),
223 crate::operation::list_objects::ListObjectsError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
224 crate::operation::list_objects::ListObjectsError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
225 crate::operation::list_objects::ListObjectsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
226 crate::operation::list_objects::ListObjectsError::Unhandled(inner) => Error::Unhandled(inner),
227 }
228 }
229}
230impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::notify_object_complete::NotifyObjectCompleteError, R>> for Error
231where
232 R: Send + Sync + std::fmt::Debug + 'static,
233{
234 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::notify_object_complete::NotifyObjectCompleteError, R>) -> Self {
235 match err {
236 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
237 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
238 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
239 source: err.into(),
240 }),
241 }
242 }
243}
244impl From<crate::operation::notify_object_complete::NotifyObjectCompleteError> for Error {
245 fn from(err: crate::operation::notify_object_complete::NotifyObjectCompleteError) -> Self {
246 match err {
247 crate::operation::notify_object_complete::NotifyObjectCompleteError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
248 crate::operation::notify_object_complete::NotifyObjectCompleteError::IllegalArgumentException(inner) => {
249 Error::IllegalArgumentException(inner)
250 }
251 crate::operation::notify_object_complete::NotifyObjectCompleteError::KmsInvalidKeyUsageException(inner) => {
252 Error::KmsInvalidKeyUsageException(inner)
253 }
254 crate::operation::notify_object_complete::NotifyObjectCompleteError::NotReadableInputStreamException(inner) => {
255 Error::NotReadableInputStreamException(inner)
256 }
257 crate::operation::notify_object_complete::NotifyObjectCompleteError::RetryableException(inner) => Error::RetryableException(inner),
258 crate::operation::notify_object_complete::NotifyObjectCompleteError::ServiceInternalException(inner) => {
259 Error::ServiceInternalException(inner)
260 }
261 crate::operation::notify_object_complete::NotifyObjectCompleteError::ServiceUnavailableException(inner) => {
262 Error::ServiceUnavailableException(inner)
263 }
264 crate::operation::notify_object_complete::NotifyObjectCompleteError::ThrottlingException(inner) => Error::ThrottlingException(inner),
265 crate::operation::notify_object_complete::NotifyObjectCompleteError::Unhandled(inner) => Error::Unhandled(inner),
266 }
267 }
268}
269impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_chunk::PutChunkError, R>> for Error
270where
271 R: Send + Sync + std::fmt::Debug + 'static,
272{
273 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_chunk::PutChunkError, R>) -> Self {
274 match err {
275 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
276 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
277 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
278 source: err.into(),
279 }),
280 }
281 }
282}
283impl From<crate::operation::put_chunk::PutChunkError> for Error {
284 fn from(err: crate::operation::put_chunk::PutChunkError) -> Self {
285 match err {
286 crate::operation::put_chunk::PutChunkError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
287 crate::operation::put_chunk::PutChunkError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
288 crate::operation::put_chunk::PutChunkError::KmsInvalidKeyUsageException(inner) => Error::KmsInvalidKeyUsageException(inner),
289 crate::operation::put_chunk::PutChunkError::NotReadableInputStreamException(inner) => Error::NotReadableInputStreamException(inner),
290 crate::operation::put_chunk::PutChunkError::RetryableException(inner) => Error::RetryableException(inner),
291 crate::operation::put_chunk::PutChunkError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
292 crate::operation::put_chunk::PutChunkError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
293 crate::operation::put_chunk::PutChunkError::ThrottlingException(inner) => Error::ThrottlingException(inner),
294 crate::operation::put_chunk::PutChunkError::Unhandled(inner) => Error::Unhandled(inner),
295 }
296 }
297}
298impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_object::PutObjectError, R>> for Error
299where
300 R: Send + Sync + std::fmt::Debug + 'static,
301{
302 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_object::PutObjectError, R>) -> Self {
303 match err {
304 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
305 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
306 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
307 source: err.into(),
308 }),
309 }
310 }
311}
312impl From<crate::operation::put_object::PutObjectError> for Error {
313 fn from(err: crate::operation::put_object::PutObjectError) -> Self {
314 match err {
315 crate::operation::put_object::PutObjectError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
316 crate::operation::put_object::PutObjectError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
317 crate::operation::put_object::PutObjectError::KmsInvalidKeyUsageException(inner) => Error::KmsInvalidKeyUsageException(inner),
318 crate::operation::put_object::PutObjectError::NotReadableInputStreamException(inner) => Error::NotReadableInputStreamException(inner),
319 crate::operation::put_object::PutObjectError::RetryableException(inner) => Error::RetryableException(inner),
320 crate::operation::put_object::PutObjectError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
321 crate::operation::put_object::PutObjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
322 crate::operation::put_object::PutObjectError::ThrottlingException(inner) => Error::ThrottlingException(inner),
323 crate::operation::put_object::PutObjectError::Unhandled(inner) => Error::Unhandled(inner),
324 }
325 }
326}
327impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_object::StartObjectError, R>> for Error
328where
329 R: Send + Sync + std::fmt::Debug + 'static,
330{
331 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_object::StartObjectError, R>) -> Self {
332 match err {
333 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
334 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
335 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
336 source: err.into(),
337 }),
338 }
339 }
340}
341impl From<crate::operation::start_object::StartObjectError> for Error {
342 fn from(err: crate::operation::start_object::StartObjectError) -> Self {
343 match err {
344 crate::operation::start_object::StartObjectError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
345 crate::operation::start_object::StartObjectError::DataAlreadyExistsException(inner) => Error::DataAlreadyExistsException(inner),
346 crate::operation::start_object::StartObjectError::IllegalArgumentException(inner) => Error::IllegalArgumentException(inner),
347 crate::operation::start_object::StartObjectError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
348 crate::operation::start_object::StartObjectError::RetryableException(inner) => Error::RetryableException(inner),
349 crate::operation::start_object::StartObjectError::ServiceInternalException(inner) => Error::ServiceInternalException(inner),
350 crate::operation::start_object::StartObjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
351 crate::operation::start_object::StartObjectError::ThrottlingException(inner) => Error::ThrottlingException(inner),
352 crate::operation::start_object::StartObjectError::Unhandled(inner) => Error::Unhandled(inner),
353 }
354 }
355}
356impl ::std::error::Error for Error {
357 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
358 match self {
359 Error::AccessDeniedException(inner) => inner.source(),
360 Error::DataAlreadyExistsException(inner) => inner.source(),
361 Error::IllegalArgumentException(inner) => inner.source(),
362 Error::KmsInvalidKeyUsageException(inner) => inner.source(),
363 Error::NotReadableInputStreamException(inner) => inner.source(),
364 Error::ResourceNotFoundException(inner) => inner.source(),
365 Error::RetryableException(inner) => inner.source(),
366 Error::ServiceInternalException(inner) => inner.source(),
367 Error::ServiceUnavailableException(inner) => inner.source(),
368 Error::ThrottlingException(inner) => inner.source(),
369 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
370 }
371 }
372}
373impl ::aws_types::request_id::RequestId for Error {
374 fn request_id(&self) -> Option<&str> {
375 match self {
376 Self::AccessDeniedException(e) => e.request_id(),
377 Self::DataAlreadyExistsException(e) => e.request_id(),
378 Self::IllegalArgumentException(e) => e.request_id(),
379 Self::KmsInvalidKeyUsageException(e) => e.request_id(),
380 Self::NotReadableInputStreamException(e) => e.request_id(),
381 Self::ResourceNotFoundException(e) => e.request_id(),
382 Self::RetryableException(e) => e.request_id(),
383 Self::ServiceInternalException(e) => e.request_id(),
384 Self::ServiceUnavailableException(e) => e.request_id(),
385 Self::ThrottlingException(e) => e.request_id(),
386 Self::Unhandled(e) => e.meta.request_id(),
387 }
388 }
389}