aws_sdk_iotdataplane/
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 version does not match the version of the document.</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>The specified combination of HTTP verb and URI is not supported.</p>
13    MethodNotAllowedException(crate::types::error::MethodNotAllowedException),
14    /// <p>The payload exceeds the maximum size allowed.</p>
15    RequestEntityTooLargeException(crate::types::error::RequestEntityTooLargeException),
16    /// <p>The specified resource does not exist.</p>
17    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
18    /// <p>The service is temporarily unavailable.</p>
19    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
20    /// <p>The rate exceeds the limit.</p>
21    ThrottlingException(crate::types::error::ThrottlingException),
22    /// <p>You are not authorized to perform this operation.</p>
23    UnauthorizedException(crate::types::error::UnauthorizedException),
24    /// <p>The document encoding is not supported.</p>
25    UnsupportedDocumentEncodingException(crate::types::error::UnsupportedDocumentEncodingException),
26    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
27    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
28    variable wildcard pattern and check `.code()`:
29     \
30    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
31     \
32    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
33    Unhandled(crate::error::sealed_unhandled::Unhandled),
34}
35impl ::std::fmt::Display for Error {
36    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37        match self {
38            Error::ConflictException(inner) => inner.fmt(f),
39            Error::InternalFailureException(inner) => inner.fmt(f),
40            Error::InvalidRequestException(inner) => inner.fmt(f),
41            Error::MethodNotAllowedException(inner) => inner.fmt(f),
42            Error::RequestEntityTooLargeException(inner) => inner.fmt(f),
43            Error::ResourceNotFoundException(inner) => inner.fmt(f),
44            Error::ServiceUnavailableException(inner) => inner.fmt(f),
45            Error::ThrottlingException(inner) => inner.fmt(f),
46            Error::UnauthorizedException(inner) => inner.fmt(f),
47            Error::UnsupportedDocumentEncodingException(inner) => inner.fmt(f),
48            Error::Unhandled(_) => {
49                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
50                    write!(f, "unhandled error ({code})")
51                } else {
52                    f.write_str("unhandled error")
53                }
54            }
55        }
56    }
57}
58impl From<::aws_smithy_types::error::operation::BuildError> for Error {
59    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
60        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
61            source: value.into(),
62            meta: ::std::default::Default::default(),
63        })
64    }
65}
66impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
67    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
68        match self {
69            Self::ConflictException(inner) => inner.meta(),
70            Self::InternalFailureException(inner) => inner.meta(),
71            Self::InvalidRequestException(inner) => inner.meta(),
72            Self::MethodNotAllowedException(inner) => inner.meta(),
73            Self::RequestEntityTooLargeException(inner) => inner.meta(),
74            Self::ResourceNotFoundException(inner) => inner.meta(),
75            Self::ServiceUnavailableException(inner) => inner.meta(),
76            Self::ThrottlingException(inner) => inner.meta(),
77            Self::UnauthorizedException(inner) => inner.meta(),
78            Self::UnsupportedDocumentEncodingException(inner) => inner.meta(),
79            Self::Unhandled(inner) => &inner.meta,
80        }
81    }
82}
83impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_thing_shadow::DeleteThingShadowError, R>> for Error
84where
85    R: Send + Sync + std::fmt::Debug + 'static,
86{
87    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_thing_shadow::DeleteThingShadowError, R>) -> Self {
88        match err {
89            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
90            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
91                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
92                source: err.into(),
93            }),
94        }
95    }
96}
97impl From<crate::operation::delete_thing_shadow::DeleteThingShadowError> for Error {
98    fn from(err: crate::operation::delete_thing_shadow::DeleteThingShadowError) -> Self {
99        match err {
100            crate::operation::delete_thing_shadow::DeleteThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
101            crate::operation::delete_thing_shadow::DeleteThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
102            crate::operation::delete_thing_shadow::DeleteThingShadowError::MethodNotAllowedException(inner) => {
103                Error::MethodNotAllowedException(inner)
104            }
105            crate::operation::delete_thing_shadow::DeleteThingShadowError::ResourceNotFoundException(inner) => {
106                Error::ResourceNotFoundException(inner)
107            }
108            crate::operation::delete_thing_shadow::DeleteThingShadowError::ServiceUnavailableException(inner) => {
109                Error::ServiceUnavailableException(inner)
110            }
111            crate::operation::delete_thing_shadow::DeleteThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
112            crate::operation::delete_thing_shadow::DeleteThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
113            crate::operation::delete_thing_shadow::DeleteThingShadowError::UnsupportedDocumentEncodingException(inner) => {
114                Error::UnsupportedDocumentEncodingException(inner)
115            }
116            crate::operation::delete_thing_shadow::DeleteThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
117        }
118    }
119}
120impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, R>> for Error
121where
122    R: Send + Sync + std::fmt::Debug + 'static,
123{
124    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, R>) -> Self {
125        match err {
126            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
127            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
128                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
129                source: err.into(),
130            }),
131        }
132    }
133}
134impl From<crate::operation::get_retained_message::GetRetainedMessageError> for Error {
135    fn from(err: crate::operation::get_retained_message::GetRetainedMessageError) -> Self {
136        match err {
137            crate::operation::get_retained_message::GetRetainedMessageError::InternalFailureException(inner) => {
138                Error::InternalFailureException(inner)
139            }
140            crate::operation::get_retained_message::GetRetainedMessageError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
141            crate::operation::get_retained_message::GetRetainedMessageError::MethodNotAllowedException(inner) => {
142                Error::MethodNotAllowedException(inner)
143            }
144            crate::operation::get_retained_message::GetRetainedMessageError::ResourceNotFoundException(inner) => {
145                Error::ResourceNotFoundException(inner)
146            }
147            crate::operation::get_retained_message::GetRetainedMessageError::ServiceUnavailableException(inner) => {
148                Error::ServiceUnavailableException(inner)
149            }
150            crate::operation::get_retained_message::GetRetainedMessageError::ThrottlingException(inner) => Error::ThrottlingException(inner),
151            crate::operation::get_retained_message::GetRetainedMessageError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
152            crate::operation::get_retained_message::GetRetainedMessageError::Unhandled(inner) => Error::Unhandled(inner),
153        }
154    }
155}
156impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_thing_shadow::GetThingShadowError, R>> for Error
157where
158    R: Send + Sync + std::fmt::Debug + 'static,
159{
160    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_thing_shadow::GetThingShadowError, R>) -> Self {
161        match err {
162            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
163            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
164                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
165                source: err.into(),
166            }),
167        }
168    }
169}
170impl From<crate::operation::get_thing_shadow::GetThingShadowError> for Error {
171    fn from(err: crate::operation::get_thing_shadow::GetThingShadowError) -> Self {
172        match err {
173            crate::operation::get_thing_shadow::GetThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
174            crate::operation::get_thing_shadow::GetThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
175            crate::operation::get_thing_shadow::GetThingShadowError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
176            crate::operation::get_thing_shadow::GetThingShadowError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
177            crate::operation::get_thing_shadow::GetThingShadowError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
178            crate::operation::get_thing_shadow::GetThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
179            crate::operation::get_thing_shadow::GetThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
180            crate::operation::get_thing_shadow::GetThingShadowError::UnsupportedDocumentEncodingException(inner) => {
181                Error::UnsupportedDocumentEncodingException(inner)
182            }
183            crate::operation::get_thing_shadow::GetThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
184        }
185    }
186}
187impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, R>>
188    for Error
189where
190    R: Send + Sync + std::fmt::Debug + 'static,
191{
192    fn from(
193        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, R>,
194    ) -> Self {
195        match err {
196            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
197            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
198                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
199                source: err.into(),
200            }),
201        }
202    }
203}
204impl From<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError> for Error {
205    fn from(err: crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError) -> Self {
206        match err {
207            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InternalFailureException(inner) => {
208                Error::InternalFailureException(inner)
209            }
210            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InvalidRequestException(inner) => {
211                Error::InvalidRequestException(inner)
212            }
213            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::MethodNotAllowedException(inner) => {
214                Error::MethodNotAllowedException(inner)
215            }
216            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ResourceNotFoundException(inner) => {
217                Error::ResourceNotFoundException(inner)
218            }
219            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ServiceUnavailableException(inner) => {
220                Error::ServiceUnavailableException(inner)
221            }
222            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ThrottlingException(inner) => {
223                Error::ThrottlingException(inner)
224            }
225            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::UnauthorizedException(inner) => {
226                Error::UnauthorizedException(inner)
227            }
228            crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::Unhandled(inner) => Error::Unhandled(inner),
229        }
230    }
231}
232impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_retained_messages::ListRetainedMessagesError, R>> for Error
233where
234    R: Send + Sync + std::fmt::Debug + 'static,
235{
236    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_retained_messages::ListRetainedMessagesError, R>) -> Self {
237        match err {
238            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
239            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
240                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
241                source: err.into(),
242            }),
243        }
244    }
245}
246impl From<crate::operation::list_retained_messages::ListRetainedMessagesError> for Error {
247    fn from(err: crate::operation::list_retained_messages::ListRetainedMessagesError) -> Self {
248        match err {
249            crate::operation::list_retained_messages::ListRetainedMessagesError::InternalFailureException(inner) => {
250                Error::InternalFailureException(inner)
251            }
252            crate::operation::list_retained_messages::ListRetainedMessagesError::InvalidRequestException(inner) => {
253                Error::InvalidRequestException(inner)
254            }
255            crate::operation::list_retained_messages::ListRetainedMessagesError::MethodNotAllowedException(inner) => {
256                Error::MethodNotAllowedException(inner)
257            }
258            crate::operation::list_retained_messages::ListRetainedMessagesError::ServiceUnavailableException(inner) => {
259                Error::ServiceUnavailableException(inner)
260            }
261            crate::operation::list_retained_messages::ListRetainedMessagesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
262            crate::operation::list_retained_messages::ListRetainedMessagesError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
263            crate::operation::list_retained_messages::ListRetainedMessagesError::Unhandled(inner) => Error::Unhandled(inner),
264        }
265    }
266}
267impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, R>> for Error
268where
269    R: Send + Sync + std::fmt::Debug + 'static,
270{
271    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, R>) -> Self {
272        match err {
273            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
274            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
275                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
276                source: err.into(),
277            }),
278        }
279    }
280}
281impl From<crate::operation::publish::PublishError> for Error {
282    fn from(err: crate::operation::publish::PublishError) -> Self {
283        match err {
284            crate::operation::publish::PublishError::InternalFailureException(inner) => Error::InternalFailureException(inner),
285            crate::operation::publish::PublishError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
286            crate::operation::publish::PublishError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
287            crate::operation::publish::PublishError::ThrottlingException(inner) => Error::ThrottlingException(inner),
288            crate::operation::publish::PublishError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
289            crate::operation::publish::PublishError::Unhandled(inner) => Error::Unhandled(inner),
290        }
291    }
292}
293impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, R>> for Error
294where
295    R: Send + Sync + std::fmt::Debug + 'static,
296{
297    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, R>) -> Self {
298        match err {
299            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
300            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
301                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
302                source: err.into(),
303            }),
304        }
305    }
306}
307impl From<crate::operation::update_thing_shadow::UpdateThingShadowError> for Error {
308    fn from(err: crate::operation::update_thing_shadow::UpdateThingShadowError) -> Self {
309        match err {
310            crate::operation::update_thing_shadow::UpdateThingShadowError::ConflictException(inner) => Error::ConflictException(inner),
311            crate::operation::update_thing_shadow::UpdateThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
312            crate::operation::update_thing_shadow::UpdateThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
313            crate::operation::update_thing_shadow::UpdateThingShadowError::MethodNotAllowedException(inner) => {
314                Error::MethodNotAllowedException(inner)
315            }
316            crate::operation::update_thing_shadow::UpdateThingShadowError::RequestEntityTooLargeException(inner) => {
317                Error::RequestEntityTooLargeException(inner)
318            }
319            crate::operation::update_thing_shadow::UpdateThingShadowError::ServiceUnavailableException(inner) => {
320                Error::ServiceUnavailableException(inner)
321            }
322            crate::operation::update_thing_shadow::UpdateThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
323            crate::operation::update_thing_shadow::UpdateThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
324            crate::operation::update_thing_shadow::UpdateThingShadowError::UnsupportedDocumentEncodingException(inner) => {
325                Error::UnsupportedDocumentEncodingException(inner)
326            }
327            crate::operation::update_thing_shadow::UpdateThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
328        }
329    }
330}
331impl ::std::error::Error for Error {
332    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
333        match self {
334            Error::ConflictException(inner) => inner.source(),
335            Error::InternalFailureException(inner) => inner.source(),
336            Error::InvalidRequestException(inner) => inner.source(),
337            Error::MethodNotAllowedException(inner) => inner.source(),
338            Error::RequestEntityTooLargeException(inner) => inner.source(),
339            Error::ResourceNotFoundException(inner) => inner.source(),
340            Error::ServiceUnavailableException(inner) => inner.source(),
341            Error::ThrottlingException(inner) => inner.source(),
342            Error::UnauthorizedException(inner) => inner.source(),
343            Error::UnsupportedDocumentEncodingException(inner) => inner.source(),
344            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
345        }
346    }
347}
348impl ::aws_types::request_id::RequestId for Error {
349    fn request_id(&self) -> Option<&str> {
350        match self {
351            Self::ConflictException(e) => e.request_id(),
352            Self::InternalFailureException(e) => e.request_id(),
353            Self::InvalidRequestException(e) => e.request_id(),
354            Self::MethodNotAllowedException(e) => e.request_id(),
355            Self::RequestEntityTooLargeException(e) => e.request_id(),
356            Self::ResourceNotFoundException(e) => e.request_id(),
357            Self::ServiceUnavailableException(e) => e.request_id(),
358            Self::ThrottlingException(e) => e.request_id(),
359            Self::UnauthorizedException(e) => e.request_id(),
360            Self::UnsupportedDocumentEncodingException(e) => e.request_id(),
361            Self::Unhandled(e) => e.meta.request_id(),
362        }
363    }
364}