1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 ConflictException(crate::types::error::ConflictException),
8 ForbiddenException(crate::types::error::ForbiddenException),
10 InternalFailureException(crate::types::error::InternalFailureException),
12 InvalidRequestException(crate::types::error::InvalidRequestException),
14 MethodNotAllowedException(crate::types::error::MethodNotAllowedException),
16 RequestEntityTooLargeException(crate::types::error::RequestEntityTooLargeException),
18 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
20 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
22 ThrottlingException(crate::types::error::ThrottlingException),
24 UnauthorizedException(crate::types::error::UnauthorizedException),
26 UnsupportedDocumentEncodingException(crate::types::error::UnsupportedDocumentEncodingException),
28 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
30 variable wildcard pattern and check `.code()`:
31 \
32 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
33 \
34 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
35 Unhandled(crate::error::sealed_unhandled::Unhandled),
36}
37impl ::std::fmt::Display for Error {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 match self {
40 Error::ConflictException(inner) => inner.fmt(f),
41 Error::ForbiddenException(inner) => inner.fmt(f),
42 Error::InternalFailureException(inner) => inner.fmt(f),
43 Error::InvalidRequestException(inner) => inner.fmt(f),
44 Error::MethodNotAllowedException(inner) => inner.fmt(f),
45 Error::RequestEntityTooLargeException(inner) => inner.fmt(f),
46 Error::ResourceNotFoundException(inner) => inner.fmt(f),
47 Error::ServiceUnavailableException(inner) => inner.fmt(f),
48 Error::ThrottlingException(inner) => inner.fmt(f),
49 Error::UnauthorizedException(inner) => inner.fmt(f),
50 Error::UnsupportedDocumentEncodingException(inner) => inner.fmt(f),
51 Error::Unhandled(_) => {
52 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
53 write!(f, "unhandled error ({code})")
54 } else {
55 f.write_str("unhandled error")
56 }
57 }
58 }
59 }
60}
61impl From<::aws_smithy_types::error::operation::BuildError> for Error {
62 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
63 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
64 source: value.into(),
65 meta: ::std::default::Default::default(),
66 })
67 }
68}
69impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
70 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
71 match self {
72 Self::ConflictException(inner) => inner.meta(),
73 Self::ForbiddenException(inner) => inner.meta(),
74 Self::InternalFailureException(inner) => inner.meta(),
75 Self::InvalidRequestException(inner) => inner.meta(),
76 Self::MethodNotAllowedException(inner) => inner.meta(),
77 Self::RequestEntityTooLargeException(inner) => inner.meta(),
78 Self::ResourceNotFoundException(inner) => inner.meta(),
79 Self::ServiceUnavailableException(inner) => inner.meta(),
80 Self::ThrottlingException(inner) => inner.meta(),
81 Self::UnauthorizedException(inner) => inner.meta(),
82 Self::UnsupportedDocumentEncodingException(inner) => inner.meta(),
83 Self::Unhandled(inner) => &inner.meta,
84 }
85 }
86}
87impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_connection::DeleteConnectionError, 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_connection::DeleteConnectionError, 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_connection::DeleteConnectionError> for Error {
102 fn from(err: crate::operation::delete_connection::DeleteConnectionError) -> Self {
103 match err {
104 crate::operation::delete_connection::DeleteConnectionError::ForbiddenException(inner) => Error::ForbiddenException(inner),
105 crate::operation::delete_connection::DeleteConnectionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
106 crate::operation::delete_connection::DeleteConnectionError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
107 crate::operation::delete_connection::DeleteConnectionError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
108 crate::operation::delete_connection::DeleteConnectionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
109 crate::operation::delete_connection::DeleteConnectionError::Unhandled(inner) => Error::Unhandled(inner),
110 }
111 }
112}
113impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_thing_shadow::DeleteThingShadowError, 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::delete_thing_shadow::DeleteThingShadowError, 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::delete_thing_shadow::DeleteThingShadowError> for Error {
128 fn from(err: crate::operation::delete_thing_shadow::DeleteThingShadowError) -> Self {
129 match err {
130 crate::operation::delete_thing_shadow::DeleteThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
131 crate::operation::delete_thing_shadow::DeleteThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
132 crate::operation::delete_thing_shadow::DeleteThingShadowError::MethodNotAllowedException(inner) => {
133 Error::MethodNotAllowedException(inner)
134 }
135 crate::operation::delete_thing_shadow::DeleteThingShadowError::ResourceNotFoundException(inner) => {
136 Error::ResourceNotFoundException(inner)
137 }
138 crate::operation::delete_thing_shadow::DeleteThingShadowError::ServiceUnavailableException(inner) => {
139 Error::ServiceUnavailableException(inner)
140 }
141 crate::operation::delete_thing_shadow::DeleteThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
142 crate::operation::delete_thing_shadow::DeleteThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
143 crate::operation::delete_thing_shadow::DeleteThingShadowError::UnsupportedDocumentEncodingException(inner) => {
144 Error::UnsupportedDocumentEncodingException(inner)
145 }
146 crate::operation::delete_thing_shadow::DeleteThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
147 }
148 }
149}
150impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, R>> for Error
151where
152 R: Send + Sync + std::fmt::Debug + 'static,
153{
154 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_retained_message::GetRetainedMessageError, R>) -> Self {
155 match err {
156 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
157 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
158 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
159 source: err.into(),
160 }),
161 }
162 }
163}
164impl From<crate::operation::get_retained_message::GetRetainedMessageError> for Error {
165 fn from(err: crate::operation::get_retained_message::GetRetainedMessageError) -> Self {
166 match err {
167 crate::operation::get_retained_message::GetRetainedMessageError::InternalFailureException(inner) => {
168 Error::InternalFailureException(inner)
169 }
170 crate::operation::get_retained_message::GetRetainedMessageError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
171 crate::operation::get_retained_message::GetRetainedMessageError::MethodNotAllowedException(inner) => {
172 Error::MethodNotAllowedException(inner)
173 }
174 crate::operation::get_retained_message::GetRetainedMessageError::ResourceNotFoundException(inner) => {
175 Error::ResourceNotFoundException(inner)
176 }
177 crate::operation::get_retained_message::GetRetainedMessageError::ServiceUnavailableException(inner) => {
178 Error::ServiceUnavailableException(inner)
179 }
180 crate::operation::get_retained_message::GetRetainedMessageError::ThrottlingException(inner) => Error::ThrottlingException(inner),
181 crate::operation::get_retained_message::GetRetainedMessageError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
182 crate::operation::get_retained_message::GetRetainedMessageError::Unhandled(inner) => Error::Unhandled(inner),
183 }
184 }
185}
186impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_thing_shadow::GetThingShadowError, 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::get_thing_shadow::GetThingShadowError, 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::get_thing_shadow::GetThingShadowError> for Error {
201 fn from(err: crate::operation::get_thing_shadow::GetThingShadowError) -> Self {
202 match err {
203 crate::operation::get_thing_shadow::GetThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
204 crate::operation::get_thing_shadow::GetThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
205 crate::operation::get_thing_shadow::GetThingShadowError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
206 crate::operation::get_thing_shadow::GetThingShadowError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
207 crate::operation::get_thing_shadow::GetThingShadowError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
208 crate::operation::get_thing_shadow::GetThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
209 crate::operation::get_thing_shadow::GetThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
210 crate::operation::get_thing_shadow::GetThingShadowError::UnsupportedDocumentEncodingException(inner) => {
211 Error::UnsupportedDocumentEncodingException(inner)
212 }
213 crate::operation::get_thing_shadow::GetThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
214 }
215 }
216}
217impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, R>>
218 for Error
219where
220 R: Send + Sync + std::fmt::Debug + 'static,
221{
222 fn from(
223 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError, R>,
224 ) -> Self {
225 match err {
226 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
227 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
228 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
229 source: err.into(),
230 }),
231 }
232 }
233}
234impl From<crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError> for Error {
235 fn from(err: crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError) -> Self {
236 match err {
237 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InternalFailureException(inner) => {
238 Error::InternalFailureException(inner)
239 }
240 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::InvalidRequestException(inner) => {
241 Error::InvalidRequestException(inner)
242 }
243 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::MethodNotAllowedException(inner) => {
244 Error::MethodNotAllowedException(inner)
245 }
246 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ResourceNotFoundException(inner) => {
247 Error::ResourceNotFoundException(inner)
248 }
249 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ServiceUnavailableException(inner) => {
250 Error::ServiceUnavailableException(inner)
251 }
252 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::ThrottlingException(inner) => {
253 Error::ThrottlingException(inner)
254 }
255 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::UnauthorizedException(inner) => {
256 Error::UnauthorizedException(inner)
257 }
258 crate::operation::list_named_shadows_for_thing::ListNamedShadowsForThingError::Unhandled(inner) => Error::Unhandled(inner),
259 }
260 }
261}
262impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_retained_messages::ListRetainedMessagesError, 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::list_retained_messages::ListRetainedMessagesError, 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::list_retained_messages::ListRetainedMessagesError> for Error {
277 fn from(err: crate::operation::list_retained_messages::ListRetainedMessagesError) -> Self {
278 match err {
279 crate::operation::list_retained_messages::ListRetainedMessagesError::InternalFailureException(inner) => {
280 Error::InternalFailureException(inner)
281 }
282 crate::operation::list_retained_messages::ListRetainedMessagesError::InvalidRequestException(inner) => {
283 Error::InvalidRequestException(inner)
284 }
285 crate::operation::list_retained_messages::ListRetainedMessagesError::MethodNotAllowedException(inner) => {
286 Error::MethodNotAllowedException(inner)
287 }
288 crate::operation::list_retained_messages::ListRetainedMessagesError::ServiceUnavailableException(inner) => {
289 Error::ServiceUnavailableException(inner)
290 }
291 crate::operation::list_retained_messages::ListRetainedMessagesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
292 crate::operation::list_retained_messages::ListRetainedMessagesError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
293 crate::operation::list_retained_messages::ListRetainedMessagesError::Unhandled(inner) => Error::Unhandled(inner),
294 }
295 }
296}
297impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, R>> for Error
298where
299 R: Send + Sync + std::fmt::Debug + 'static,
300{
301 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::publish::PublishError, R>) -> Self {
302 match err {
303 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
304 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
305 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
306 source: err.into(),
307 }),
308 }
309 }
310}
311impl From<crate::operation::publish::PublishError> for Error {
312 fn from(err: crate::operation::publish::PublishError) -> Self {
313 match err {
314 crate::operation::publish::PublishError::InternalFailureException(inner) => Error::InternalFailureException(inner),
315 crate::operation::publish::PublishError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
316 crate::operation::publish::PublishError::MethodNotAllowedException(inner) => Error::MethodNotAllowedException(inner),
317 crate::operation::publish::PublishError::ThrottlingException(inner) => Error::ThrottlingException(inner),
318 crate::operation::publish::PublishError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
319 crate::operation::publish::PublishError::Unhandled(inner) => Error::Unhandled(inner),
320 }
321 }
322}
323impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, R>> for Error
324where
325 R: Send + Sync + std::fmt::Debug + 'static,
326{
327 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_thing_shadow::UpdateThingShadowError, R>) -> Self {
328 match err {
329 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
330 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
331 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
332 source: err.into(),
333 }),
334 }
335 }
336}
337impl From<crate::operation::update_thing_shadow::UpdateThingShadowError> for Error {
338 fn from(err: crate::operation::update_thing_shadow::UpdateThingShadowError) -> Self {
339 match err {
340 crate::operation::update_thing_shadow::UpdateThingShadowError::ConflictException(inner) => Error::ConflictException(inner),
341 crate::operation::update_thing_shadow::UpdateThingShadowError::InternalFailureException(inner) => Error::InternalFailureException(inner),
342 crate::operation::update_thing_shadow::UpdateThingShadowError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
343 crate::operation::update_thing_shadow::UpdateThingShadowError::MethodNotAllowedException(inner) => {
344 Error::MethodNotAllowedException(inner)
345 }
346 crate::operation::update_thing_shadow::UpdateThingShadowError::RequestEntityTooLargeException(inner) => {
347 Error::RequestEntityTooLargeException(inner)
348 }
349 crate::operation::update_thing_shadow::UpdateThingShadowError::ServiceUnavailableException(inner) => {
350 Error::ServiceUnavailableException(inner)
351 }
352 crate::operation::update_thing_shadow::UpdateThingShadowError::ThrottlingException(inner) => Error::ThrottlingException(inner),
353 crate::operation::update_thing_shadow::UpdateThingShadowError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
354 crate::operation::update_thing_shadow::UpdateThingShadowError::UnsupportedDocumentEncodingException(inner) => {
355 Error::UnsupportedDocumentEncodingException(inner)
356 }
357 crate::operation::update_thing_shadow::UpdateThingShadowError::Unhandled(inner) => Error::Unhandled(inner),
358 }
359 }
360}
361impl ::std::error::Error for Error {
362 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
363 match self {
364 Error::ConflictException(inner) => inner.source(),
365 Error::ForbiddenException(inner) => inner.source(),
366 Error::InternalFailureException(inner) => inner.source(),
367 Error::InvalidRequestException(inner) => inner.source(),
368 Error::MethodNotAllowedException(inner) => inner.source(),
369 Error::RequestEntityTooLargeException(inner) => inner.source(),
370 Error::ResourceNotFoundException(inner) => inner.source(),
371 Error::ServiceUnavailableException(inner) => inner.source(),
372 Error::ThrottlingException(inner) => inner.source(),
373 Error::UnauthorizedException(inner) => inner.source(),
374 Error::UnsupportedDocumentEncodingException(inner) => inner.source(),
375 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
376 }
377 }
378}
379impl ::aws_types::request_id::RequestId for Error {
380 fn request_id(&self) -> Option<&str> {
381 match self {
382 Self::ConflictException(e) => e.request_id(),
383 Self::ForbiddenException(e) => e.request_id(),
384 Self::InternalFailureException(e) => e.request_id(),
385 Self::InvalidRequestException(e) => e.request_id(),
386 Self::MethodNotAllowedException(e) => e.request_id(),
387 Self::RequestEntityTooLargeException(e) => e.request_id(),
388 Self::ResourceNotFoundException(e) => e.request_id(),
389 Self::ServiceUnavailableException(e) => e.request_id(),
390 Self::ThrottlingException(e) => e.request_id(),
391 Self::UnauthorizedException(e) => e.request_id(),
392 Self::UnsupportedDocumentEncodingException(e) => e.request_id(),
393 Self::Unhandled(e) => e.meta.request_id(),
394 }
395 }
396}