aws_sdk_iotfleethub/
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 request conflicts with the current state of the resource.</p>
7    ConflictException(crate::types::error::ConflictException),
8    /// <p>An unexpected error has occurred.</p>
9    InternalFailureException(crate::types::error::InternalFailureException),
10    /// <p>The request is not valid.</p>
11    InvalidRequestException(crate::types::error::InvalidRequestException),
12    /// <p>A limit has been exceeded.</p>
13    LimitExceededException(crate::types::error::LimitExceededException),
14    /// <p>The specified resource does not exist.</p>
15    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
16    /// <p>The rate exceeds the limit.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
19    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20    variable wildcard pattern and check `.code()`:
21     \
22    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
23     \
24    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
25    Unhandled(crate::error::sealed_unhandled::Unhandled),
26}
27impl ::std::fmt::Display for Error {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        match self {
30            Error::ConflictException(inner) => inner.fmt(f),
31            Error::InternalFailureException(inner) => inner.fmt(f),
32            Error::InvalidRequestException(inner) => inner.fmt(f),
33            Error::LimitExceededException(inner) => inner.fmt(f),
34            Error::ResourceNotFoundException(inner) => inner.fmt(f),
35            Error::ThrottlingException(inner) => inner.fmt(f),
36            Error::Unhandled(_) => {
37                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
38                    write!(f, "unhandled error ({code})")
39                } else {
40                    f.write_str("unhandled error")
41                }
42            }
43        }
44    }
45}
46impl From<::aws_smithy_types::error::operation::BuildError> for Error {
47    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
48        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
49            source: value.into(),
50            meta: ::std::default::Default::default(),
51        })
52    }
53}
54impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
55    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
56        match self {
57            Self::ConflictException(inner) => inner.meta(),
58            Self::InternalFailureException(inner) => inner.meta(),
59            Self::InvalidRequestException(inner) => inner.meta(),
60            Self::LimitExceededException(inner) => inner.meta(),
61            Self::ResourceNotFoundException(inner) => inner.meta(),
62            Self::ThrottlingException(inner) => inner.meta(),
63            Self::Unhandled(inner) => &inner.meta,
64        }
65    }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_application::CreateApplicationError, R>> for Error
68where
69    R: Send + Sync + std::fmt::Debug + 'static,
70{
71    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_application::CreateApplicationError, R>) -> Self {
72        match err {
73            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
74            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
75                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
76                source: err.into(),
77            }),
78        }
79    }
80}
81impl From<crate::operation::create_application::CreateApplicationError> for Error {
82    fn from(err: crate::operation::create_application::CreateApplicationError) -> Self {
83        match err {
84            crate::operation::create_application::CreateApplicationError::InternalFailureException(inner) => Error::InternalFailureException(inner),
85            crate::operation::create_application::CreateApplicationError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
86            crate::operation::create_application::CreateApplicationError::LimitExceededException(inner) => Error::LimitExceededException(inner),
87            crate::operation::create_application::CreateApplicationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
88            crate::operation::create_application::CreateApplicationError::Unhandled(inner) => Error::Unhandled(inner),
89        }
90    }
91}
92impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_application::DeleteApplicationError, R>> for Error
93where
94    R: Send + Sync + std::fmt::Debug + 'static,
95{
96    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_application::DeleteApplicationError, R>) -> Self {
97        match err {
98            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
99            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
100                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
101                source: err.into(),
102            }),
103        }
104    }
105}
106impl From<crate::operation::delete_application::DeleteApplicationError> for Error {
107    fn from(err: crate::operation::delete_application::DeleteApplicationError) -> Self {
108        match err {
109            crate::operation::delete_application::DeleteApplicationError::InternalFailureException(inner) => Error::InternalFailureException(inner),
110            crate::operation::delete_application::DeleteApplicationError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
111            crate::operation::delete_application::DeleteApplicationError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
112            crate::operation::delete_application::DeleteApplicationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
113            crate::operation::delete_application::DeleteApplicationError::Unhandled(inner) => Error::Unhandled(inner),
114        }
115    }
116}
117impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_application::DescribeApplicationError, R>> for Error
118where
119    R: Send + Sync + std::fmt::Debug + 'static,
120{
121    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_application::DescribeApplicationError, R>) -> Self {
122        match err {
123            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
124            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
125                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
126                source: err.into(),
127            }),
128        }
129    }
130}
131impl From<crate::operation::describe_application::DescribeApplicationError> for Error {
132    fn from(err: crate::operation::describe_application::DescribeApplicationError) -> Self {
133        match err {
134            crate::operation::describe_application::DescribeApplicationError::InternalFailureException(inner) => {
135                Error::InternalFailureException(inner)
136            }
137            crate::operation::describe_application::DescribeApplicationError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
138            crate::operation::describe_application::DescribeApplicationError::ResourceNotFoundException(inner) => {
139                Error::ResourceNotFoundException(inner)
140            }
141            crate::operation::describe_application::DescribeApplicationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
142            crate::operation::describe_application::DescribeApplicationError::Unhandled(inner) => Error::Unhandled(inner),
143        }
144    }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_applications::ListApplicationsError, R>> for Error
147where
148    R: Send + Sync + std::fmt::Debug + 'static,
149{
150    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_applications::ListApplicationsError, R>) -> Self {
151        match err {
152            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
154                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
155                source: err.into(),
156            }),
157        }
158    }
159}
160impl From<crate::operation::list_applications::ListApplicationsError> for Error {
161    fn from(err: crate::operation::list_applications::ListApplicationsError) -> Self {
162        match err {
163            crate::operation::list_applications::ListApplicationsError::InternalFailureException(inner) => Error::InternalFailureException(inner),
164            crate::operation::list_applications::ListApplicationsError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
165            crate::operation::list_applications::ListApplicationsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
166            crate::operation::list_applications::ListApplicationsError::Unhandled(inner) => Error::Unhandled(inner),
167        }
168    }
169}
170impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
171where
172    R: Send + Sync + std::fmt::Debug + 'static,
173{
174    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
175        match err {
176            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
177            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
178                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
179                source: err.into(),
180            }),
181        }
182    }
183}
184impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
185    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
186        match err {
187            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalFailureException(inner) => {
188                Error::InternalFailureException(inner)
189            }
190            crate::operation::list_tags_for_resource::ListTagsForResourceError::InvalidRequestException(inner) => {
191                Error::InvalidRequestException(inner)
192            }
193            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
194                Error::ResourceNotFoundException(inner)
195            }
196            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
197        }
198    }
199}
200impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
201where
202    R: Send + Sync + std::fmt::Debug + 'static,
203{
204    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
205        match err {
206            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
207            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
208                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
209                source: err.into(),
210            }),
211        }
212    }
213}
214impl From<crate::operation::tag_resource::TagResourceError> for Error {
215    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
216        match err {
217            crate::operation::tag_resource::TagResourceError::InternalFailureException(inner) => Error::InternalFailureException(inner),
218            crate::operation::tag_resource::TagResourceError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
219            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
220            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
221        }
222    }
223}
224impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
225where
226    R: Send + Sync + std::fmt::Debug + 'static,
227{
228    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
229        match err {
230            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
231            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
232                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
233                source: err.into(),
234            }),
235        }
236    }
237}
238impl From<crate::operation::untag_resource::UntagResourceError> for Error {
239    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
240        match err {
241            crate::operation::untag_resource::UntagResourceError::InternalFailureException(inner) => Error::InternalFailureException(inner),
242            crate::operation::untag_resource::UntagResourceError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
243            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
244            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
245        }
246    }
247}
248impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_application::UpdateApplicationError, R>> for Error
249where
250    R: Send + Sync + std::fmt::Debug + 'static,
251{
252    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_application::UpdateApplicationError, R>) -> Self {
253        match err {
254            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
255            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
256                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
257                source: err.into(),
258            }),
259        }
260    }
261}
262impl From<crate::operation::update_application::UpdateApplicationError> for Error {
263    fn from(err: crate::operation::update_application::UpdateApplicationError) -> Self {
264        match err {
265            crate::operation::update_application::UpdateApplicationError::ConflictException(inner) => Error::ConflictException(inner),
266            crate::operation::update_application::UpdateApplicationError::InternalFailureException(inner) => Error::InternalFailureException(inner),
267            crate::operation::update_application::UpdateApplicationError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
268            crate::operation::update_application::UpdateApplicationError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
269            crate::operation::update_application::UpdateApplicationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
270            crate::operation::update_application::UpdateApplicationError::Unhandled(inner) => Error::Unhandled(inner),
271        }
272    }
273}
274impl ::std::error::Error for Error {
275    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
276        match self {
277            Error::ConflictException(inner) => inner.source(),
278            Error::InternalFailureException(inner) => inner.source(),
279            Error::InvalidRequestException(inner) => inner.source(),
280            Error::LimitExceededException(inner) => inner.source(),
281            Error::ResourceNotFoundException(inner) => inner.source(),
282            Error::ThrottlingException(inner) => inner.source(),
283            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
284        }
285    }
286}
287impl ::aws_types::request_id::RequestId for Error {
288    fn request_id(&self) -> Option<&str> {
289        match self {
290            Self::ConflictException(e) => e.request_id(),
291            Self::InternalFailureException(e) => e.request_id(),
292            Self::InvalidRequestException(e) => e.request_id(),
293            Self::LimitExceededException(e) => e.request_id(),
294            Self::ResourceNotFoundException(e) => e.request_id(),
295            Self::ThrottlingException(e) => e.request_id(),
296            Self::Unhandled(e) => e.meta.request_id(),
297        }
298    }
299}