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