aws_sdk_notificationscontacts/
error_meta.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// All possible error types for this service.
3#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6    /// <p>You do not have sufficient access to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>Updating or deleting a resource can cause an inconsistent state.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>Unexpected error during processing of request.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>Your request references a resource which does not exist.</p>
13    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14    /// <p>Request would cause a service quota to be exceeded.</p>
15    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16    /// <p>The request was denied due to request throttling.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// <p>The input fails to satisfy the constraints specified by an AWS service.</p>
19    ValidationException(crate::types::error::ValidationException),
20    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
21    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22    variable wildcard pattern and check `.code()`:
23     \
24    &nbsp;&nbsp;&nbsp;`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::activate_email_contact::ActivateEmailContactError, 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::activate_email_contact::ActivateEmailContactError, 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::activate_email_contact::ActivateEmailContactError> for Error {
86    fn from(err: crate::operation::activate_email_contact::ActivateEmailContactError) -> Self {
87        match err {
88            crate::operation::activate_email_contact::ActivateEmailContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89            crate::operation::activate_email_contact::ActivateEmailContactError::ConflictException(inner) => Error::ConflictException(inner),
90            crate::operation::activate_email_contact::ActivateEmailContactError::InternalServerException(inner) => {
91                Error::InternalServerException(inner)
92            }
93            crate::operation::activate_email_contact::ActivateEmailContactError::ResourceNotFoundException(inner) => {
94                Error::ResourceNotFoundException(inner)
95            }
96            crate::operation::activate_email_contact::ActivateEmailContactError::ThrottlingException(inner) => Error::ThrottlingException(inner),
97            crate::operation::activate_email_contact::ActivateEmailContactError::ValidationException(inner) => Error::ValidationException(inner),
98            crate::operation::activate_email_contact::ActivateEmailContactError::Unhandled(inner) => Error::Unhandled(inner),
99        }
100    }
101}
102impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_email_contact::CreateEmailContactError, 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_email_contact::CreateEmailContactError, 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_email_contact::CreateEmailContactError> for Error {
117    fn from(err: crate::operation::create_email_contact::CreateEmailContactError) -> Self {
118        match err {
119            crate::operation::create_email_contact::CreateEmailContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
120            crate::operation::create_email_contact::CreateEmailContactError::ConflictException(inner) => Error::ConflictException(inner),
121            crate::operation::create_email_contact::CreateEmailContactError::InternalServerException(inner) => Error::InternalServerException(inner),
122            crate::operation::create_email_contact::CreateEmailContactError::ServiceQuotaExceededException(inner) => {
123                Error::ServiceQuotaExceededException(inner)
124            }
125            crate::operation::create_email_contact::CreateEmailContactError::ThrottlingException(inner) => Error::ThrottlingException(inner),
126            crate::operation::create_email_contact::CreateEmailContactError::ValidationException(inner) => Error::ValidationException(inner),
127            crate::operation::create_email_contact::CreateEmailContactError::Unhandled(inner) => Error::Unhandled(inner),
128        }
129    }
130}
131impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_email_contact::DeleteEmailContactError, R>> for Error
132where
133    R: Send + Sync + std::fmt::Debug + 'static,
134{
135    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_email_contact::DeleteEmailContactError, R>) -> Self {
136        match err {
137            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
138            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
139                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
140                source: err.into(),
141            }),
142        }
143    }
144}
145impl From<crate::operation::delete_email_contact::DeleteEmailContactError> for Error {
146    fn from(err: crate::operation::delete_email_contact::DeleteEmailContactError) -> Self {
147        match err {
148            crate::operation::delete_email_contact::DeleteEmailContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
149            crate::operation::delete_email_contact::DeleteEmailContactError::ConflictException(inner) => Error::ConflictException(inner),
150            crate::operation::delete_email_contact::DeleteEmailContactError::InternalServerException(inner) => Error::InternalServerException(inner),
151            crate::operation::delete_email_contact::DeleteEmailContactError::ResourceNotFoundException(inner) => {
152                Error::ResourceNotFoundException(inner)
153            }
154            crate::operation::delete_email_contact::DeleteEmailContactError::ThrottlingException(inner) => Error::ThrottlingException(inner),
155            crate::operation::delete_email_contact::DeleteEmailContactError::ValidationException(inner) => Error::ValidationException(inner),
156            crate::operation::delete_email_contact::DeleteEmailContactError::Unhandled(inner) => Error::Unhandled(inner),
157        }
158    }
159}
160impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_email_contact::GetEmailContactError, R>> for Error
161where
162    R: Send + Sync + std::fmt::Debug + 'static,
163{
164    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_email_contact::GetEmailContactError, R>) -> Self {
165        match err {
166            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
167            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
168                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
169                source: err.into(),
170            }),
171        }
172    }
173}
174impl From<crate::operation::get_email_contact::GetEmailContactError> for Error {
175    fn from(err: crate::operation::get_email_contact::GetEmailContactError) -> Self {
176        match err {
177            crate::operation::get_email_contact::GetEmailContactError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
178            crate::operation::get_email_contact::GetEmailContactError::InternalServerException(inner) => Error::InternalServerException(inner),
179            crate::operation::get_email_contact::GetEmailContactError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
180            crate::operation::get_email_contact::GetEmailContactError::ThrottlingException(inner) => Error::ThrottlingException(inner),
181            crate::operation::get_email_contact::GetEmailContactError::ValidationException(inner) => Error::ValidationException(inner),
182            crate::operation::get_email_contact::GetEmailContactError::Unhandled(inner) => Error::Unhandled(inner),
183        }
184    }
185}
186impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_email_contacts::ListEmailContactsError, 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::list_email_contacts::ListEmailContactsError, 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::list_email_contacts::ListEmailContactsError> for Error {
201    fn from(err: crate::operation::list_email_contacts::ListEmailContactsError) -> Self {
202        match err {
203            crate::operation::list_email_contacts::ListEmailContactsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
204            crate::operation::list_email_contacts::ListEmailContactsError::InternalServerException(inner) => Error::InternalServerException(inner),
205            crate::operation::list_email_contacts::ListEmailContactsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
206            crate::operation::list_email_contacts::ListEmailContactsError::ValidationException(inner) => Error::ValidationException(inner),
207            crate::operation::list_email_contacts::ListEmailContactsError::Unhandled(inner) => Error::Unhandled(inner),
208        }
209    }
210}
211impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
212where
213    R: Send + Sync + std::fmt::Debug + 'static,
214{
215    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
216        match err {
217            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
218            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
219                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
220                source: err.into(),
221            }),
222        }
223    }
224}
225impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
226    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
227        match err {
228            crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
229            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
230                Error::InternalServerException(inner)
231            }
232            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
233                Error::ResourceNotFoundException(inner)
234            }
235            crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
236            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
237            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
238        }
239    }
240}
241impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_activation_code::SendActivationCodeError, R>> for Error
242where
243    R: Send + Sync + std::fmt::Debug + 'static,
244{
245    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_activation_code::SendActivationCodeError, R>) -> Self {
246        match err {
247            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
248            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
249                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
250                source: err.into(),
251            }),
252        }
253    }
254}
255impl From<crate::operation::send_activation_code::SendActivationCodeError> for Error {
256    fn from(err: crate::operation::send_activation_code::SendActivationCodeError) -> Self {
257        match err {
258            crate::operation::send_activation_code::SendActivationCodeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
259            crate::operation::send_activation_code::SendActivationCodeError::ConflictException(inner) => Error::ConflictException(inner),
260            crate::operation::send_activation_code::SendActivationCodeError::InternalServerException(inner) => Error::InternalServerException(inner),
261            crate::operation::send_activation_code::SendActivationCodeError::ResourceNotFoundException(inner) => {
262                Error::ResourceNotFoundException(inner)
263            }
264            crate::operation::send_activation_code::SendActivationCodeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
265            crate::operation::send_activation_code::SendActivationCodeError::ValidationException(inner) => Error::ValidationException(inner),
266            crate::operation::send_activation_code::SendActivationCodeError::Unhandled(inner) => Error::Unhandled(inner),
267        }
268    }
269}
270impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, 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::tag_resource::TagResourceError, 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::tag_resource::TagResourceError> for Error {
285    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
286        match err {
287            crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
288            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
289            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
290            crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
291            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
292            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
293        }
294    }
295}
296impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
297where
298    R: Send + Sync + std::fmt::Debug + 'static,
299{
300    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
301        match err {
302            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
303            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
304                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
305                source: err.into(),
306            }),
307        }
308    }
309}
310impl From<crate::operation::untag_resource::UntagResourceError> for Error {
311    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
312        match err {
313            crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
314            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
315            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
316            crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
317            crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
318            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
319        }
320    }
321}
322impl ::std::error::Error for Error {
323    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
324        match self {
325            Error::AccessDeniedException(inner) => inner.source(),
326            Error::ConflictException(inner) => inner.source(),
327            Error::InternalServerException(inner) => inner.source(),
328            Error::ResourceNotFoundException(inner) => inner.source(),
329            Error::ServiceQuotaExceededException(inner) => inner.source(),
330            Error::ThrottlingException(inner) => inner.source(),
331            Error::ValidationException(inner) => inner.source(),
332            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
333        }
334    }
335}
336impl ::aws_types::request_id::RequestId for Error {
337    fn request_id(&self) -> Option<&str> {
338        match self {
339            Self::AccessDeniedException(e) => e.request_id(),
340            Self::ConflictException(e) => e.request_id(),
341            Self::InternalServerException(e) => e.request_id(),
342            Self::ResourceNotFoundException(e) => e.request_id(),
343            Self::ServiceQuotaExceededException(e) => e.request_id(),
344            Self::ThrottlingException(e) => e.request_id(),
345            Self::ValidationException(e) => e.request_id(),
346            Self::Unhandled(e) => e.meta.request_id(),
347        }
348    }
349}