1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 ConcurrentModificationException(crate::types::error::ConcurrentModificationException),
10 ConfigurationException(crate::types::error::ConfigurationException),
12 InvalidNextTokenException(crate::types::error::InvalidNextTokenException),
14 LimitExceededException(crate::types::error::LimitExceededException),
16 ResourceAlreadyExistsException(crate::types::error::ResourceAlreadyExistsException),
18 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
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::ConcurrentModificationException(inner) => inner.fmt(f),
36 Error::ConfigurationException(inner) => inner.fmt(f),
37 Error::InvalidNextTokenException(inner) => inner.fmt(f),
38 Error::LimitExceededException(inner) => inner.fmt(f),
39 Error::ResourceAlreadyExistsException(inner) => inner.fmt(f),
40 Error::ResourceNotFoundException(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::ConcurrentModificationException(inner) => inner.meta(),
65 Self::ConfigurationException(inner) => inner.meta(),
66 Self::InvalidNextTokenException(inner) => inner.meta(),
67 Self::LimitExceededException(inner) => inner.meta(),
68 Self::ResourceAlreadyExistsException(inner) => inner.meta(),
69 Self::ResourceNotFoundException(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_notification_rule::CreateNotificationRuleError, R>> for Error
76where
77 R: Send + Sync + std::fmt::Debug + 'static,
78{
79 fn from(
80 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_notification_rule::CreateNotificationRuleError, R>,
81 ) -> Self {
82 match err {
83 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
84 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
85 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
86 source: err.into(),
87 }),
88 }
89 }
90}
91impl From<crate::operation::create_notification_rule::CreateNotificationRuleError> for Error {
92 fn from(err: crate::operation::create_notification_rule::CreateNotificationRuleError) -> Self {
93 match err {
94 crate::operation::create_notification_rule::CreateNotificationRuleError::AccessDeniedException(inner) => {
95 Error::AccessDeniedException(inner)
96 }
97 crate::operation::create_notification_rule::CreateNotificationRuleError::ConcurrentModificationException(inner) => {
98 Error::ConcurrentModificationException(inner)
99 }
100 crate::operation::create_notification_rule::CreateNotificationRuleError::ConfigurationException(inner) => {
101 Error::ConfigurationException(inner)
102 }
103 crate::operation::create_notification_rule::CreateNotificationRuleError::LimitExceededException(inner) => {
104 Error::LimitExceededException(inner)
105 }
106 crate::operation::create_notification_rule::CreateNotificationRuleError::ResourceAlreadyExistsException(inner) => {
107 Error::ResourceAlreadyExistsException(inner)
108 }
109 crate::operation::create_notification_rule::CreateNotificationRuleError::ValidationException(inner) => Error::ValidationException(inner),
110 crate::operation::create_notification_rule::CreateNotificationRuleError::Unhandled(inner) => Error::Unhandled(inner),
111 }
112 }
113}
114impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_notification_rule::DeleteNotificationRuleError, R>> for Error
115where
116 R: Send + Sync + std::fmt::Debug + 'static,
117{
118 fn from(
119 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_notification_rule::DeleteNotificationRuleError, R>,
120 ) -> Self {
121 match err {
122 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
123 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
124 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
125 source: err.into(),
126 }),
127 }
128 }
129}
130impl From<crate::operation::delete_notification_rule::DeleteNotificationRuleError> for Error {
131 fn from(err: crate::operation::delete_notification_rule::DeleteNotificationRuleError) -> Self {
132 match err {
133 crate::operation::delete_notification_rule::DeleteNotificationRuleError::ConcurrentModificationException(inner) => {
134 Error::ConcurrentModificationException(inner)
135 }
136 crate::operation::delete_notification_rule::DeleteNotificationRuleError::LimitExceededException(inner) => {
137 Error::LimitExceededException(inner)
138 }
139 crate::operation::delete_notification_rule::DeleteNotificationRuleError::ValidationException(inner) => Error::ValidationException(inner),
140 crate::operation::delete_notification_rule::DeleteNotificationRuleError::Unhandled(inner) => Error::Unhandled(inner),
141 }
142 }
143}
144impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_target::DeleteTargetError, R>> for Error
145where
146 R: Send + Sync + std::fmt::Debug + 'static,
147{
148 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_target::DeleteTargetError, R>) -> Self {
149 match err {
150 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
151 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
152 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
153 source: err.into(),
154 }),
155 }
156 }
157}
158impl From<crate::operation::delete_target::DeleteTargetError> for Error {
159 fn from(err: crate::operation::delete_target::DeleteTargetError) -> Self {
160 match err {
161 crate::operation::delete_target::DeleteTargetError::ValidationException(inner) => Error::ValidationException(inner),
162 crate::operation::delete_target::DeleteTargetError::Unhandled(inner) => Error::Unhandled(inner),
163 }
164 }
165}
166impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_notification_rule::DescribeNotificationRuleError, R>>
167 for Error
168where
169 R: Send + Sync + std::fmt::Debug + 'static,
170{
171 fn from(
172 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_notification_rule::DescribeNotificationRuleError, R>,
173 ) -> Self {
174 match err {
175 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
176 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
177 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
178 source: err.into(),
179 }),
180 }
181 }
182}
183impl From<crate::operation::describe_notification_rule::DescribeNotificationRuleError> for Error {
184 fn from(err: crate::operation::describe_notification_rule::DescribeNotificationRuleError) -> Self {
185 match err {
186 crate::operation::describe_notification_rule::DescribeNotificationRuleError::ResourceNotFoundException(inner) => {
187 Error::ResourceNotFoundException(inner)
188 }
189 crate::operation::describe_notification_rule::DescribeNotificationRuleError::ValidationException(inner) => {
190 Error::ValidationException(inner)
191 }
192 crate::operation::describe_notification_rule::DescribeNotificationRuleError::Unhandled(inner) => Error::Unhandled(inner),
193 }
194 }
195}
196impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_event_types::ListEventTypesError, R>> for Error
197where
198 R: Send + Sync + std::fmt::Debug + 'static,
199{
200 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_event_types::ListEventTypesError, R>) -> Self {
201 match err {
202 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
203 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
204 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
205 source: err.into(),
206 }),
207 }
208 }
209}
210impl From<crate::operation::list_event_types::ListEventTypesError> for Error {
211 fn from(err: crate::operation::list_event_types::ListEventTypesError) -> Self {
212 match err {
213 crate::operation::list_event_types::ListEventTypesError::InvalidNextTokenException(inner) => Error::InvalidNextTokenException(inner),
214 crate::operation::list_event_types::ListEventTypesError::ValidationException(inner) => Error::ValidationException(inner),
215 crate::operation::list_event_types::ListEventTypesError::Unhandled(inner) => Error::Unhandled(inner),
216 }
217 }
218}
219impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_notification_rules::ListNotificationRulesError, R>> for Error
220where
221 R: Send + Sync + std::fmt::Debug + 'static,
222{
223 fn from(
224 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_notification_rules::ListNotificationRulesError, R>,
225 ) -> Self {
226 match err {
227 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
228 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
229 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
230 source: err.into(),
231 }),
232 }
233 }
234}
235impl From<crate::operation::list_notification_rules::ListNotificationRulesError> for Error {
236 fn from(err: crate::operation::list_notification_rules::ListNotificationRulesError) -> Self {
237 match err {
238 crate::operation::list_notification_rules::ListNotificationRulesError::InvalidNextTokenException(inner) => {
239 Error::InvalidNextTokenException(inner)
240 }
241 crate::operation::list_notification_rules::ListNotificationRulesError::ValidationException(inner) => Error::ValidationException(inner),
242 crate::operation::list_notification_rules::ListNotificationRulesError::Unhandled(inner) => Error::Unhandled(inner),
243 }
244 }
245}
246impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
247where
248 R: Send + Sync + std::fmt::Debug + 'static,
249{
250 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
251 match err {
252 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
253 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
254 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
255 source: err.into(),
256 }),
257 }
258 }
259}
260impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
261 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
262 match err {
263 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
264 Error::ResourceNotFoundException(inner)
265 }
266 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
267 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
268 }
269 }
270}
271impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_targets::ListTargetsError, R>> for Error
272where
273 R: Send + Sync + std::fmt::Debug + 'static,
274{
275 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_targets::ListTargetsError, R>) -> Self {
276 match err {
277 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
278 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
279 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
280 source: err.into(),
281 }),
282 }
283 }
284}
285impl From<crate::operation::list_targets::ListTargetsError> for Error {
286 fn from(err: crate::operation::list_targets::ListTargetsError) -> Self {
287 match err {
288 crate::operation::list_targets::ListTargetsError::InvalidNextTokenException(inner) => Error::InvalidNextTokenException(inner),
289 crate::operation::list_targets::ListTargetsError::ValidationException(inner) => Error::ValidationException(inner),
290 crate::operation::list_targets::ListTargetsError::Unhandled(inner) => Error::Unhandled(inner),
291 }
292 }
293}
294impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::subscribe::SubscribeError, R>> for Error
295where
296 R: Send + Sync + std::fmt::Debug + 'static,
297{
298 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::subscribe::SubscribeError, R>) -> Self {
299 match err {
300 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
301 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
302 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
303 source: err.into(),
304 }),
305 }
306 }
307}
308impl From<crate::operation::subscribe::SubscribeError> for Error {
309 fn from(err: crate::operation::subscribe::SubscribeError) -> Self {
310 match err {
311 crate::operation::subscribe::SubscribeError::ConfigurationException(inner) => Error::ConfigurationException(inner),
312 crate::operation::subscribe::SubscribeError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
313 crate::operation::subscribe::SubscribeError::ValidationException(inner) => Error::ValidationException(inner),
314 crate::operation::subscribe::SubscribeError::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::ConcurrentModificationException(inner) => Error::ConcurrentModificationException(inner),
336 crate::operation::tag_resource::TagResourceError::LimitExceededException(inner) => Error::LimitExceededException(inner),
337 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(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::unsubscribe::UnsubscribeError, 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::unsubscribe::UnsubscribeError, 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::unsubscribe::UnsubscribeError> for Error {
358 fn from(err: crate::operation::unsubscribe::UnsubscribeError) -> Self {
359 match err {
360 crate::operation::unsubscribe::UnsubscribeError::ValidationException(inner) => Error::ValidationException(inner),
361 crate::operation::unsubscribe::UnsubscribeError::Unhandled(inner) => Error::Unhandled(inner),
362 }
363 }
364}
365impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
366where
367 R: Send + Sync + std::fmt::Debug + 'static,
368{
369 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
370 match err {
371 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
372 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
373 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
374 source: err.into(),
375 }),
376 }
377 }
378}
379impl From<crate::operation::untag_resource::UntagResourceError> for Error {
380 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
381 match err {
382 crate::operation::untag_resource::UntagResourceError::ConcurrentModificationException(inner) => {
383 Error::ConcurrentModificationException(inner)
384 }
385 crate::operation::untag_resource::UntagResourceError::LimitExceededException(inner) => Error::LimitExceededException(inner),
386 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
387 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
388 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
389 }
390 }
391}
392impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_notification_rule::UpdateNotificationRuleError, R>> for Error
393where
394 R: Send + Sync + std::fmt::Debug + 'static,
395{
396 fn from(
397 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_notification_rule::UpdateNotificationRuleError, R>,
398 ) -> Self {
399 match err {
400 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
401 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
402 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
403 source: err.into(),
404 }),
405 }
406 }
407}
408impl From<crate::operation::update_notification_rule::UpdateNotificationRuleError> for Error {
409 fn from(err: crate::operation::update_notification_rule::UpdateNotificationRuleError) -> Self {
410 match err {
411 crate::operation::update_notification_rule::UpdateNotificationRuleError::ConfigurationException(inner) => {
412 Error::ConfigurationException(inner)
413 }
414 crate::operation::update_notification_rule::UpdateNotificationRuleError::ResourceNotFoundException(inner) => {
415 Error::ResourceNotFoundException(inner)
416 }
417 crate::operation::update_notification_rule::UpdateNotificationRuleError::ValidationException(inner) => Error::ValidationException(inner),
418 crate::operation::update_notification_rule::UpdateNotificationRuleError::Unhandled(inner) => Error::Unhandled(inner),
419 }
420 }
421}
422impl ::std::error::Error for Error {
423 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
424 match self {
425 Error::AccessDeniedException(inner) => inner.source(),
426 Error::ConcurrentModificationException(inner) => inner.source(),
427 Error::ConfigurationException(inner) => inner.source(),
428 Error::InvalidNextTokenException(inner) => inner.source(),
429 Error::LimitExceededException(inner) => inner.source(),
430 Error::ResourceAlreadyExistsException(inner) => inner.source(),
431 Error::ResourceNotFoundException(inner) => inner.source(),
432 Error::ValidationException(inner) => inner.source(),
433 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
434 }
435 }
436}
437impl ::aws_types::request_id::RequestId for Error {
438 fn request_id(&self) -> Option<&str> {
439 match self {
440 Self::AccessDeniedException(e) => e.request_id(),
441 Self::ConcurrentModificationException(e) => e.request_id(),
442 Self::ConfigurationException(e) => e.request_id(),
443 Self::InvalidNextTokenException(e) => e.request_id(),
444 Self::LimitExceededException(e) => e.request_id(),
445 Self::ResourceAlreadyExistsException(e) => e.request_id(),
446 Self::ResourceNotFoundException(e) => e.request_id(),
447 Self::ValidationException(e) => e.request_id(),
448 Self::Unhandled(e) => e.meta.request_id(),
449 }
450 }
451}