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