aws_sdk_rbin/
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>The specified retention rule lock request can't be completed.</p>
7    ConflictException(crate::types::error::ConflictException),
8    /// <p>The service could not respond to the request due to an internal problem.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>The specified resource was not found.</p>
11    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12    /// <p>The request would cause a service quota for the number of tags per resource to be exceeded.</p>
13    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
14    /// <p>One or more of the parameters in the request is not valid.</p>
15    ValidationException(crate::types::error::ValidationException),
16    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
17    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18    variable wildcard pattern and check `.code()`:
19     \
20    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
21     \
22    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
23    Unhandled(crate::error::sealed_unhandled::Unhandled),
24}
25impl ::std::fmt::Display for Error {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Error::ConflictException(inner) => inner.fmt(f),
29            Error::InternalServerException(inner) => inner.fmt(f),
30            Error::ResourceNotFoundException(inner) => inner.fmt(f),
31            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
32            Error::ValidationException(inner) => inner.fmt(f),
33            Error::Unhandled(_) => {
34                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
35                    write!(f, "unhandled error ({code})")
36                } else {
37                    f.write_str("unhandled error")
38                }
39            }
40        }
41    }
42}
43impl From<::aws_smithy_types::error::operation::BuildError> for Error {
44    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
45        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
46            source: value.into(),
47            meta: ::std::default::Default::default(),
48        })
49    }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
52    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
53        match self {
54            Self::ConflictException(inner) => inner.meta(),
55            Self::InternalServerException(inner) => inner.meta(),
56            Self::ResourceNotFoundException(inner) => inner.meta(),
57            Self::ServiceQuotaExceededException(inner) => inner.meta(),
58            Self::ValidationException(inner) => inner.meta(),
59            Self::Unhandled(inner) => &inner.meta,
60        }
61    }
62}
63impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_rule::CreateRuleError, R>> for Error
64where
65    R: Send + Sync + std::fmt::Debug + 'static,
66{
67    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_rule::CreateRuleError, R>) -> Self {
68        match err {
69            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
70            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
71                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
72                source: err.into(),
73            }),
74        }
75    }
76}
77impl From<crate::operation::create_rule::CreateRuleError> for Error {
78    fn from(err: crate::operation::create_rule::CreateRuleError) -> Self {
79        match err {
80            crate::operation::create_rule::CreateRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
81            crate::operation::create_rule::CreateRuleError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
82            crate::operation::create_rule::CreateRuleError::ValidationException(inner) => Error::ValidationException(inner),
83            crate::operation::create_rule::CreateRuleError::Unhandled(inner) => Error::Unhandled(inner),
84        }
85    }
86}
87impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_rule::DeleteRuleError, R>> for Error
88where
89    R: Send + Sync + std::fmt::Debug + 'static,
90{
91    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_rule::DeleteRuleError, R>) -> Self {
92        match err {
93            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
94            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
95                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
96                source: err.into(),
97            }),
98        }
99    }
100}
101impl From<crate::operation::delete_rule::DeleteRuleError> for Error {
102    fn from(err: crate::operation::delete_rule::DeleteRuleError) -> Self {
103        match err {
104            crate::operation::delete_rule::DeleteRuleError::ConflictException(inner) => Error::ConflictException(inner),
105            crate::operation::delete_rule::DeleteRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
106            crate::operation::delete_rule::DeleteRuleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
107            crate::operation::delete_rule::DeleteRuleError::ValidationException(inner) => Error::ValidationException(inner),
108            crate::operation::delete_rule::DeleteRuleError::Unhandled(inner) => Error::Unhandled(inner),
109        }
110    }
111}
112impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_rule::GetRuleError, R>> for Error
113where
114    R: Send + Sync + std::fmt::Debug + 'static,
115{
116    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_rule::GetRuleError, R>) -> Self {
117        match err {
118            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
119            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
120                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
121                source: err.into(),
122            }),
123        }
124    }
125}
126impl From<crate::operation::get_rule::GetRuleError> for Error {
127    fn from(err: crate::operation::get_rule::GetRuleError) -> Self {
128        match err {
129            crate::operation::get_rule::GetRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
130            crate::operation::get_rule::GetRuleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
131            crate::operation::get_rule::GetRuleError::ValidationException(inner) => Error::ValidationException(inner),
132            crate::operation::get_rule::GetRuleError::Unhandled(inner) => Error::Unhandled(inner),
133        }
134    }
135}
136impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_rules::ListRulesError, R>> for Error
137where
138    R: Send + Sync + std::fmt::Debug + 'static,
139{
140    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_rules::ListRulesError, R>) -> Self {
141        match err {
142            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
143            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
144                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
145                source: err.into(),
146            }),
147        }
148    }
149}
150impl From<crate::operation::list_rules::ListRulesError> for Error {
151    fn from(err: crate::operation::list_rules::ListRulesError) -> Self {
152        match err {
153            crate::operation::list_rules::ListRulesError::InternalServerException(inner) => Error::InternalServerException(inner),
154            crate::operation::list_rules::ListRulesError::ValidationException(inner) => Error::ValidationException(inner),
155            crate::operation::list_rules::ListRulesError::Unhandled(inner) => Error::Unhandled(inner),
156        }
157    }
158}
159impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError> for Error {
174    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
175        match err {
176            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
177                Error::InternalServerException(inner)
178            }
179            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
180                Error::ResourceNotFoundException(inner)
181            }
182            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
183            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
184        }
185    }
186}
187impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::lock_rule::LockRuleError, R>> for Error
188where
189    R: Send + Sync + std::fmt::Debug + 'static,
190{
191    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::lock_rule::LockRuleError, R>) -> Self {
192        match err {
193            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
194            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
195                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
196                source: err.into(),
197            }),
198        }
199    }
200}
201impl From<crate::operation::lock_rule::LockRuleError> for Error {
202    fn from(err: crate::operation::lock_rule::LockRuleError) -> Self {
203        match err {
204            crate::operation::lock_rule::LockRuleError::ConflictException(inner) => Error::ConflictException(inner),
205            crate::operation::lock_rule::LockRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
206            crate::operation::lock_rule::LockRuleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
207            crate::operation::lock_rule::LockRuleError::ValidationException(inner) => Error::ValidationException(inner),
208            crate::operation::lock_rule::LockRuleError::Unhandled(inner) => Error::Unhandled(inner),
209        }
210    }
211}
212impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, 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::tag_resource::TagResourceError, 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::tag_resource::TagResourceError> for Error {
227    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
228        match err {
229            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
230            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
231            crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
232            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
233            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
234        }
235    }
236}
237impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::unlock_rule::UnlockRuleError, R>> for Error
238where
239    R: Send + Sync + std::fmt::Debug + 'static,
240{
241    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::unlock_rule::UnlockRuleError, R>) -> Self {
242        match err {
243            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
244            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
245                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
246                source: err.into(),
247            }),
248        }
249    }
250}
251impl From<crate::operation::unlock_rule::UnlockRuleError> for Error {
252    fn from(err: crate::operation::unlock_rule::UnlockRuleError) -> Self {
253        match err {
254            crate::operation::unlock_rule::UnlockRuleError::ConflictException(inner) => Error::ConflictException(inner),
255            crate::operation::unlock_rule::UnlockRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
256            crate::operation::unlock_rule::UnlockRuleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
257            crate::operation::unlock_rule::UnlockRuleError::ValidationException(inner) => Error::ValidationException(inner),
258            crate::operation::unlock_rule::UnlockRuleError::Unhandled(inner) => Error::Unhandled(inner),
259        }
260    }
261}
262impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
263where
264    R: Send + Sync + std::fmt::Debug + 'static,
265{
266    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
267        match err {
268            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
269            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
270                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
271                source: err.into(),
272            }),
273        }
274    }
275}
276impl From<crate::operation::untag_resource::UntagResourceError> for Error {
277    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
278        match err {
279            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
280            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
281            crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
282            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
283        }
284    }
285}
286impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_rule::UpdateRuleError, R>> for Error
287where
288    R: Send + Sync + std::fmt::Debug + 'static,
289{
290    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_rule::UpdateRuleError, R>) -> Self {
291        match err {
292            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
293            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
294                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
295                source: err.into(),
296            }),
297        }
298    }
299}
300impl From<crate::operation::update_rule::UpdateRuleError> for Error {
301    fn from(err: crate::operation::update_rule::UpdateRuleError) -> Self {
302        match err {
303            crate::operation::update_rule::UpdateRuleError::ConflictException(inner) => Error::ConflictException(inner),
304            crate::operation::update_rule::UpdateRuleError::InternalServerException(inner) => Error::InternalServerException(inner),
305            crate::operation::update_rule::UpdateRuleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
306            crate::operation::update_rule::UpdateRuleError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
307            crate::operation::update_rule::UpdateRuleError::ValidationException(inner) => Error::ValidationException(inner),
308            crate::operation::update_rule::UpdateRuleError::Unhandled(inner) => Error::Unhandled(inner),
309        }
310    }
311}
312impl ::std::error::Error for Error {
313    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
314        match self {
315            Error::ConflictException(inner) => inner.source(),
316            Error::InternalServerException(inner) => inner.source(),
317            Error::ResourceNotFoundException(inner) => inner.source(),
318            Error::ServiceQuotaExceededException(inner) => inner.source(),
319            Error::ValidationException(inner) => inner.source(),
320            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
321        }
322    }
323}
324impl ::aws_types::request_id::RequestId for Error {
325    fn request_id(&self) -> Option<&str> {
326        match self {
327            Self::ConflictException(e) => e.request_id(),
328            Self::InternalServerException(e) => e.request_id(),
329            Self::ResourceNotFoundException(e) => e.request_id(),
330            Self::ServiceQuotaExceededException(e) => e.request_id(),
331            Self::ValidationException(e) => e.request_id(),
332            Self::Unhandled(e) => e.meta.request_id(),
333        }
334    }
335}