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