aws_sdk_iotdeviceadvisor/
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>Sends a Conflict Exception.</p>
7    ConflictException(crate::types::error::ConflictException),
8    /// <p>Sends an Internal Failure exception.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>Sends a Resource Not Found exception.</p>
11    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12    /// <p>Sends a validation exception.</p>
13    ValidationException(crate::types::error::ValidationException),
14    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
15    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16    variable wildcard pattern and check `.code()`:
17     \
18    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
19     \
20    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
21    Unhandled(crate::error::sealed_unhandled::Unhandled),
22}
23impl ::std::fmt::Display for Error {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            Error::ConflictException(inner) => inner.fmt(f),
27            Error::InternalServerException(inner) => inner.fmt(f),
28            Error::ResourceNotFoundException(inner) => inner.fmt(f),
29            Error::ValidationException(inner) => inner.fmt(f),
30            Error::Unhandled(_) => {
31                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
32                    write!(f, "unhandled error ({code})")
33                } else {
34                    f.write_str("unhandled error")
35                }
36            }
37        }
38    }
39}
40impl From<::aws_smithy_types::error::operation::BuildError> for Error {
41    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
42        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
43            source: value.into(),
44            meta: ::std::default::Default::default(),
45        })
46    }
47}
48impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
49    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
50        match self {
51            Self::ConflictException(inner) => inner.meta(),
52            Self::InternalServerException(inner) => inner.meta(),
53            Self::ResourceNotFoundException(inner) => inner.meta(),
54            Self::ValidationException(inner) => inner.meta(),
55            Self::Unhandled(inner) => &inner.meta,
56        }
57    }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_suite_definition::CreateSuiteDefinitionError, R>> for Error
60where
61    R: Send + Sync + std::fmt::Debug + 'static,
62{
63    fn from(
64        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_suite_definition::CreateSuiteDefinitionError, R>,
65    ) -> Self {
66        match err {
67            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
68            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
69                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
70                source: err.into(),
71            }),
72        }
73    }
74}
75impl From<crate::operation::create_suite_definition::CreateSuiteDefinitionError> for Error {
76    fn from(err: crate::operation::create_suite_definition::CreateSuiteDefinitionError) -> Self {
77        match err {
78            crate::operation::create_suite_definition::CreateSuiteDefinitionError::InternalServerException(inner) => {
79                Error::InternalServerException(inner)
80            }
81            crate::operation::create_suite_definition::CreateSuiteDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
82            crate::operation::create_suite_definition::CreateSuiteDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
83        }
84    }
85}
86impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_suite_definition::DeleteSuiteDefinitionError, R>> for Error
87where
88    R: Send + Sync + std::fmt::Debug + 'static,
89{
90    fn from(
91        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_suite_definition::DeleteSuiteDefinitionError, R>,
92    ) -> Self {
93        match err {
94            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
95            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
96                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
97                source: err.into(),
98            }),
99        }
100    }
101}
102impl From<crate::operation::delete_suite_definition::DeleteSuiteDefinitionError> for Error {
103    fn from(err: crate::operation::delete_suite_definition::DeleteSuiteDefinitionError) -> Self {
104        match err {
105            crate::operation::delete_suite_definition::DeleteSuiteDefinitionError::InternalServerException(inner) => {
106                Error::InternalServerException(inner)
107            }
108            crate::operation::delete_suite_definition::DeleteSuiteDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
109            crate::operation::delete_suite_definition::DeleteSuiteDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
110        }
111    }
112}
113impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_endpoint::GetEndpointError, R>> for Error
114where
115    R: Send + Sync + std::fmt::Debug + 'static,
116{
117    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_endpoint::GetEndpointError, R>) -> Self {
118        match err {
119            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
120            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
121                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
122                source: err.into(),
123            }),
124        }
125    }
126}
127impl From<crate::operation::get_endpoint::GetEndpointError> for Error {
128    fn from(err: crate::operation::get_endpoint::GetEndpointError) -> Self {
129        match err {
130            crate::operation::get_endpoint::GetEndpointError::InternalServerException(inner) => Error::InternalServerException(inner),
131            crate::operation::get_endpoint::GetEndpointError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
132            crate::operation::get_endpoint::GetEndpointError::ValidationException(inner) => Error::ValidationException(inner),
133            crate::operation::get_endpoint::GetEndpointError::Unhandled(inner) => Error::Unhandled(inner),
134        }
135    }
136}
137impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_suite_definition::GetSuiteDefinitionError, R>> for Error
138where
139    R: Send + Sync + std::fmt::Debug + 'static,
140{
141    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_suite_definition::GetSuiteDefinitionError, R>) -> Self {
142        match err {
143            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
144            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
145                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
146                source: err.into(),
147            }),
148        }
149    }
150}
151impl From<crate::operation::get_suite_definition::GetSuiteDefinitionError> for Error {
152    fn from(err: crate::operation::get_suite_definition::GetSuiteDefinitionError) -> Self {
153        match err {
154            crate::operation::get_suite_definition::GetSuiteDefinitionError::InternalServerException(inner) => Error::InternalServerException(inner),
155            crate::operation::get_suite_definition::GetSuiteDefinitionError::ResourceNotFoundException(inner) => {
156                Error::ResourceNotFoundException(inner)
157            }
158            crate::operation::get_suite_definition::GetSuiteDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
159            crate::operation::get_suite_definition::GetSuiteDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
160        }
161    }
162}
163impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_suite_run::GetSuiteRunError, R>> for Error
164where
165    R: Send + Sync + std::fmt::Debug + 'static,
166{
167    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_suite_run::GetSuiteRunError, R>) -> Self {
168        match err {
169            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
170            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
171                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
172                source: err.into(),
173            }),
174        }
175    }
176}
177impl From<crate::operation::get_suite_run::GetSuiteRunError> for Error {
178    fn from(err: crate::operation::get_suite_run::GetSuiteRunError) -> Self {
179        match err {
180            crate::operation::get_suite_run::GetSuiteRunError::InternalServerException(inner) => Error::InternalServerException(inner),
181            crate::operation::get_suite_run::GetSuiteRunError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
182            crate::operation::get_suite_run::GetSuiteRunError::ValidationException(inner) => Error::ValidationException(inner),
183            crate::operation::get_suite_run::GetSuiteRunError::Unhandled(inner) => Error::Unhandled(inner),
184        }
185    }
186}
187impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_suite_run_report::GetSuiteRunReportError, 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::get_suite_run_report::GetSuiteRunReportError, 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::get_suite_run_report::GetSuiteRunReportError> for Error {
202    fn from(err: crate::operation::get_suite_run_report::GetSuiteRunReportError) -> Self {
203        match err {
204            crate::operation::get_suite_run_report::GetSuiteRunReportError::InternalServerException(inner) => Error::InternalServerException(inner),
205            crate::operation::get_suite_run_report::GetSuiteRunReportError::ResourceNotFoundException(inner) => {
206                Error::ResourceNotFoundException(inner)
207            }
208            crate::operation::get_suite_run_report::GetSuiteRunReportError::ValidationException(inner) => Error::ValidationException(inner),
209            crate::operation::get_suite_run_report::GetSuiteRunReportError::Unhandled(inner) => Error::Unhandled(inner),
210        }
211    }
212}
213impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_suite_definitions::ListSuiteDefinitionsError, R>> for Error
214where
215    R: Send + Sync + std::fmt::Debug + 'static,
216{
217    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_suite_definitions::ListSuiteDefinitionsError, R>) -> Self {
218        match err {
219            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
220            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
221                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
222                source: err.into(),
223            }),
224        }
225    }
226}
227impl From<crate::operation::list_suite_definitions::ListSuiteDefinitionsError> for Error {
228    fn from(err: crate::operation::list_suite_definitions::ListSuiteDefinitionsError) -> Self {
229        match err {
230            crate::operation::list_suite_definitions::ListSuiteDefinitionsError::InternalServerException(inner) => {
231                Error::InternalServerException(inner)
232            }
233            crate::operation::list_suite_definitions::ListSuiteDefinitionsError::ValidationException(inner) => Error::ValidationException(inner),
234            crate::operation::list_suite_definitions::ListSuiteDefinitionsError::Unhandled(inner) => Error::Unhandled(inner),
235        }
236    }
237}
238impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_suite_runs::ListSuiteRunsError, R>> for Error
239where
240    R: Send + Sync + std::fmt::Debug + 'static,
241{
242    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_suite_runs::ListSuiteRunsError, R>) -> Self {
243        match err {
244            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
245            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
246                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
247                source: err.into(),
248            }),
249        }
250    }
251}
252impl From<crate::operation::list_suite_runs::ListSuiteRunsError> for Error {
253    fn from(err: crate::operation::list_suite_runs::ListSuiteRunsError) -> Self {
254        match err {
255            crate::operation::list_suite_runs::ListSuiteRunsError::InternalServerException(inner) => Error::InternalServerException(inner),
256            crate::operation::list_suite_runs::ListSuiteRunsError::ValidationException(inner) => Error::ValidationException(inner),
257            crate::operation::list_suite_runs::ListSuiteRunsError::Unhandled(inner) => Error::Unhandled(inner),
258        }
259    }
260}
261impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
262where
263    R: Send + Sync + std::fmt::Debug + 'static,
264{
265    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
266        match err {
267            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
268            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
269                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
270                source: err.into(),
271            }),
272        }
273    }
274}
275impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
276    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
277        match err {
278            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
279                Error::InternalServerException(inner)
280            }
281            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
282                Error::ResourceNotFoundException(inner)
283            }
284            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
285            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
286        }
287    }
288}
289impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_suite_run::StartSuiteRunError, R>> for Error
290where
291    R: Send + Sync + std::fmt::Debug + 'static,
292{
293    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_suite_run::StartSuiteRunError, R>) -> Self {
294        match err {
295            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
296            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
297                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
298                source: err.into(),
299            }),
300        }
301    }
302}
303impl From<crate::operation::start_suite_run::StartSuiteRunError> for Error {
304    fn from(err: crate::operation::start_suite_run::StartSuiteRunError) -> Self {
305        match err {
306            crate::operation::start_suite_run::StartSuiteRunError::ConflictException(inner) => Error::ConflictException(inner),
307            crate::operation::start_suite_run::StartSuiteRunError::InternalServerException(inner) => Error::InternalServerException(inner),
308            crate::operation::start_suite_run::StartSuiteRunError::ValidationException(inner) => Error::ValidationException(inner),
309            crate::operation::start_suite_run::StartSuiteRunError::Unhandled(inner) => Error::Unhandled(inner),
310        }
311    }
312}
313impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::stop_suite_run::StopSuiteRunError, R>> for Error
314where
315    R: Send + Sync + std::fmt::Debug + 'static,
316{
317    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::stop_suite_run::StopSuiteRunError, R>) -> Self {
318        match err {
319            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
320            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
321                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
322                source: err.into(),
323            }),
324        }
325    }
326}
327impl From<crate::operation::stop_suite_run::StopSuiteRunError> for Error {
328    fn from(err: crate::operation::stop_suite_run::StopSuiteRunError) -> Self {
329        match err {
330            crate::operation::stop_suite_run::StopSuiteRunError::InternalServerException(inner) => Error::InternalServerException(inner),
331            crate::operation::stop_suite_run::StopSuiteRunError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
332            crate::operation::stop_suite_run::StopSuiteRunError::ValidationException(inner) => Error::ValidationException(inner),
333            crate::operation::stop_suite_run::StopSuiteRunError::Unhandled(inner) => Error::Unhandled(inner),
334        }
335    }
336}
337impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
338where
339    R: Send + Sync + std::fmt::Debug + 'static,
340{
341    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
342        match err {
343            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
344            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
345                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
346                source: err.into(),
347            }),
348        }
349    }
350}
351impl From<crate::operation::tag_resource::TagResourceError> for Error {
352    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
353        match err {
354            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
355            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
356            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
357            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
358        }
359    }
360}
361impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
362where
363    R: Send + Sync + std::fmt::Debug + 'static,
364{
365    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
366        match err {
367            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
368            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
369                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
370                source: err.into(),
371            }),
372        }
373    }
374}
375impl From<crate::operation::untag_resource::UntagResourceError> for Error {
376    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
377        match err {
378            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
379            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
380            crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
381            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
382        }
383    }
384}
385impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_suite_definition::UpdateSuiteDefinitionError, R>> for Error
386where
387    R: Send + Sync + std::fmt::Debug + 'static,
388{
389    fn from(
390        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_suite_definition::UpdateSuiteDefinitionError, R>,
391    ) -> Self {
392        match err {
393            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
394            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
395                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
396                source: err.into(),
397            }),
398        }
399    }
400}
401impl From<crate::operation::update_suite_definition::UpdateSuiteDefinitionError> for Error {
402    fn from(err: crate::operation::update_suite_definition::UpdateSuiteDefinitionError) -> Self {
403        match err {
404            crate::operation::update_suite_definition::UpdateSuiteDefinitionError::InternalServerException(inner) => {
405                Error::InternalServerException(inner)
406            }
407            crate::operation::update_suite_definition::UpdateSuiteDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
408            crate::operation::update_suite_definition::UpdateSuiteDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
409        }
410    }
411}
412impl ::std::error::Error for Error {
413    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
414        match self {
415            Error::ConflictException(inner) => inner.source(),
416            Error::InternalServerException(inner) => inner.source(),
417            Error::ResourceNotFoundException(inner) => inner.source(),
418            Error::ValidationException(inner) => inner.source(),
419            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
420        }
421    }
422}
423impl ::aws_types::request_id::RequestId for Error {
424    fn request_id(&self) -> Option<&str> {
425        match self {
426            Self::ConflictException(e) => e.request_id(),
427            Self::InternalServerException(e) => e.request_id(),
428            Self::ResourceNotFoundException(e) => e.request_id(),
429            Self::ValidationException(e) => e.request_id(),
430            Self::Unhandled(e) => e.meta.request_id(),
431        }
432    }
433}