aws_sdk_pinpointsmsvoice/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AlreadyExistsException(crate::types::error::AlreadyExistsException),
8 BadRequestException(crate::types::error::BadRequestException),
10 InternalServiceErrorException(crate::types::error::InternalServiceErrorException),
12 LimitExceededException(crate::types::error::LimitExceededException),
14 NotFoundException(crate::types::error::NotFoundException),
16 TooManyRequestsException(crate::types::error::TooManyRequestsException),
18 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20 variable wildcard pattern and check `.code()`:
21 \
22 `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::AlreadyExistsException(inner) => inner.fmt(f),
31 Error::BadRequestException(inner) => inner.fmt(f),
32 Error::InternalServiceErrorException(inner) => inner.fmt(f),
33 Error::LimitExceededException(inner) => inner.fmt(f),
34 Error::NotFoundException(inner) => inner.fmt(f),
35 Error::TooManyRequestsException(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::AlreadyExistsException(inner) => inner.meta(),
58 Self::BadRequestException(inner) => inner.meta(),
59 Self::InternalServiceErrorException(inner) => inner.meta(),
60 Self::LimitExceededException(inner) => inner.meta(),
61 Self::NotFoundException(inner) => inner.meta(),
62 Self::TooManyRequestsException(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_configuration_set::CreateConfigurationSetError, R>> for Error
68where
69 R: Send + Sync + std::fmt::Debug + 'static,
70{
71 fn from(
72 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_configuration_set::CreateConfigurationSetError, R>,
73 ) -> Self {
74 match err {
75 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
76 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
77 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
78 source: err.into(),
79 }),
80 }
81 }
82}
83impl From<crate::operation::create_configuration_set::CreateConfigurationSetError> for Error {
84 fn from(err: crate::operation::create_configuration_set::CreateConfigurationSetError) -> Self {
85 match err {
86 crate::operation::create_configuration_set::CreateConfigurationSetError::AlreadyExistsException(inner) => {
87 Error::AlreadyExistsException(inner)
88 }
89 crate::operation::create_configuration_set::CreateConfigurationSetError::BadRequestException(inner) => Error::BadRequestException(inner),
90 crate::operation::create_configuration_set::CreateConfigurationSetError::InternalServiceErrorException(inner) => {
91 Error::InternalServiceErrorException(inner)
92 }
93 crate::operation::create_configuration_set::CreateConfigurationSetError::LimitExceededException(inner) => {
94 Error::LimitExceededException(inner)
95 }
96 crate::operation::create_configuration_set::CreateConfigurationSetError::TooManyRequestsException(inner) => {
97 Error::TooManyRequestsException(inner)
98 }
99 crate::operation::create_configuration_set::CreateConfigurationSetError::Unhandled(inner) => Error::Unhandled(inner),
100 }
101 }
102}
103impl<R>
104 From<
105 ::aws_smithy_runtime_api::client::result::SdkError<
106 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError,
107 R,
108 >,
109 > for Error
110where
111 R: Send + Sync + std::fmt::Debug + 'static,
112{
113 fn from(
114 err: ::aws_smithy_runtime_api::client::result::SdkError<
115 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError,
116 R,
117 >,
118 ) -> Self {
119 match err {
120 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
121 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
122 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
123 source: err.into(),
124 }),
125 }
126 }
127}
128impl From<crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError> for Error {
129 fn from(err: crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError) -> Self {
130 match err {
131 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::AlreadyExistsException(inner) => Error::AlreadyExistsException(inner),
132 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::BadRequestException(inner) => Error::BadRequestException(inner),
133 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::InternalServiceErrorException(inner) => Error::InternalServiceErrorException(inner),
134 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::LimitExceededException(inner) => Error::LimitExceededException(inner),
135 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::NotFoundException(inner) => Error::NotFoundException(inner),
136 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
137 crate::operation::create_configuration_set_event_destination::CreateConfigurationSetEventDestinationError::Unhandled(inner) => Error::Unhandled(inner),
138 }
139 }
140}
141impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_configuration_set::DeleteConfigurationSetError, R>> for Error
142where
143 R: Send + Sync + std::fmt::Debug + 'static,
144{
145 fn from(
146 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_configuration_set::DeleteConfigurationSetError, R>,
147 ) -> Self {
148 match err {
149 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
150 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
151 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
152 source: err.into(),
153 }),
154 }
155 }
156}
157impl From<crate::operation::delete_configuration_set::DeleteConfigurationSetError> for Error {
158 fn from(err: crate::operation::delete_configuration_set::DeleteConfigurationSetError) -> Self {
159 match err {
160 crate::operation::delete_configuration_set::DeleteConfigurationSetError::BadRequestException(inner) => Error::BadRequestException(inner),
161 crate::operation::delete_configuration_set::DeleteConfigurationSetError::InternalServiceErrorException(inner) => {
162 Error::InternalServiceErrorException(inner)
163 }
164 crate::operation::delete_configuration_set::DeleteConfigurationSetError::NotFoundException(inner) => Error::NotFoundException(inner),
165 crate::operation::delete_configuration_set::DeleteConfigurationSetError::TooManyRequestsException(inner) => {
166 Error::TooManyRequestsException(inner)
167 }
168 crate::operation::delete_configuration_set::DeleteConfigurationSetError::Unhandled(inner) => Error::Unhandled(inner),
169 }
170 }
171}
172impl<R>
173 From<
174 ::aws_smithy_runtime_api::client::result::SdkError<
175 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError,
176 R,
177 >,
178 > for Error
179where
180 R: Send + Sync + std::fmt::Debug + 'static,
181{
182 fn from(
183 err: ::aws_smithy_runtime_api::client::result::SdkError<
184 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError,
185 R,
186 >,
187 ) -> Self {
188 match err {
189 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
190 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
191 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
192 source: err.into(),
193 }),
194 }
195 }
196}
197impl From<crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError> for Error {
198 fn from(err: crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError) -> Self {
199 match err {
200 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError::BadRequestException(inner) => Error::BadRequestException(inner),
201 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError::InternalServiceErrorException(inner) => Error::InternalServiceErrorException(inner),
202 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError::NotFoundException(inner) => Error::NotFoundException(inner),
203 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
204 crate::operation::delete_configuration_set_event_destination::DeleteConfigurationSetEventDestinationError::Unhandled(inner) => Error::Unhandled(inner),
205 }
206 }
207}
208impl<R>
209 From<
210 ::aws_smithy_runtime_api::client::result::SdkError<
211 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError,
212 R,
213 >,
214 > for Error
215where
216 R: Send + Sync + std::fmt::Debug + 'static,
217{
218 fn from(
219 err: ::aws_smithy_runtime_api::client::result::SdkError<
220 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError,
221 R,
222 >,
223 ) -> Self {
224 match err {
225 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
226 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
227 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
228 source: err.into(),
229 }),
230 }
231 }
232}
233impl From<crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError> for Error {
234 fn from(err: crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError) -> Self {
235 match err {
236 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError::BadRequestException(inner) => {
237 Error::BadRequestException(inner)
238 }
239 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError::InternalServiceErrorException(
240 inner,
241 ) => Error::InternalServiceErrorException(inner),
242 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError::NotFoundException(inner) => {
243 Error::NotFoundException(inner)
244 }
245 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError::TooManyRequestsException(
246 inner,
247 ) => Error::TooManyRequestsException(inner),
248 crate::operation::get_configuration_set_event_destinations::GetConfigurationSetEventDestinationsError::Unhandled(inner) => {
249 Error::Unhandled(inner)
250 }
251 }
252 }
253}
254impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_configuration_sets::ListConfigurationSetsError, R>> for Error
255where
256 R: Send + Sync + std::fmt::Debug + 'static,
257{
258 fn from(
259 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_configuration_sets::ListConfigurationSetsError, R>,
260 ) -> Self {
261 match err {
262 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
263 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
264 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
265 source: err.into(),
266 }),
267 }
268 }
269}
270impl From<crate::operation::list_configuration_sets::ListConfigurationSetsError> for Error {
271 fn from(err: crate::operation::list_configuration_sets::ListConfigurationSetsError) -> Self {
272 match err {
273 crate::operation::list_configuration_sets::ListConfigurationSetsError::BadRequestException(inner) => Error::BadRequestException(inner),
274 crate::operation::list_configuration_sets::ListConfigurationSetsError::InternalServiceErrorException(inner) => {
275 Error::InternalServiceErrorException(inner)
276 }
277 crate::operation::list_configuration_sets::ListConfigurationSetsError::TooManyRequestsException(inner) => {
278 Error::TooManyRequestsException(inner)
279 }
280 crate::operation::list_configuration_sets::ListConfigurationSetsError::Unhandled(inner) => Error::Unhandled(inner),
281 }
282 }
283}
284impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_voice_message::SendVoiceMessageError, R>> for Error
285where
286 R: Send + Sync + std::fmt::Debug + 'static,
287{
288 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_voice_message::SendVoiceMessageError, R>) -> Self {
289 match err {
290 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
291 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
292 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
293 source: err.into(),
294 }),
295 }
296 }
297}
298impl From<crate::operation::send_voice_message::SendVoiceMessageError> for Error {
299 fn from(err: crate::operation::send_voice_message::SendVoiceMessageError) -> Self {
300 match err {
301 crate::operation::send_voice_message::SendVoiceMessageError::BadRequestException(inner) => Error::BadRequestException(inner),
302 crate::operation::send_voice_message::SendVoiceMessageError::InternalServiceErrorException(inner) => {
303 Error::InternalServiceErrorException(inner)
304 }
305 crate::operation::send_voice_message::SendVoiceMessageError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
306 crate::operation::send_voice_message::SendVoiceMessageError::Unhandled(inner) => Error::Unhandled(inner),
307 }
308 }
309}
310impl<R>
311 From<
312 ::aws_smithy_runtime_api::client::result::SdkError<
313 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError,
314 R,
315 >,
316 > for Error
317where
318 R: Send + Sync + std::fmt::Debug + 'static,
319{
320 fn from(
321 err: ::aws_smithy_runtime_api::client::result::SdkError<
322 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError,
323 R,
324 >,
325 ) -> Self {
326 match err {
327 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
328 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
329 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
330 source: err.into(),
331 }),
332 }
333 }
334}
335impl From<crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError> for Error {
336 fn from(err: crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError) -> Self {
337 match err {
338 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError::BadRequestException(inner) => Error::BadRequestException(inner),
339 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError::InternalServiceErrorException(inner) => Error::InternalServiceErrorException(inner),
340 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError::NotFoundException(inner) => Error::NotFoundException(inner),
341 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
342 crate::operation::update_configuration_set_event_destination::UpdateConfigurationSetEventDestinationError::Unhandled(inner) => Error::Unhandled(inner),
343 }
344 }
345}
346impl ::std::error::Error for Error {
347 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
348 match self {
349 Error::AlreadyExistsException(inner) => inner.source(),
350 Error::BadRequestException(inner) => inner.source(),
351 Error::InternalServiceErrorException(inner) => inner.source(),
352 Error::LimitExceededException(inner) => inner.source(),
353 Error::NotFoundException(inner) => inner.source(),
354 Error::TooManyRequestsException(inner) => inner.source(),
355 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
356 }
357 }
358}
359impl ::aws_types::request_id::RequestId for Error {
360 fn request_id(&self) -> Option<&str> {
361 match self {
362 Self::AlreadyExistsException(e) => e.request_id(),
363 Self::BadRequestException(e) => e.request_id(),
364 Self::InternalServiceErrorException(e) => e.request_id(),
365 Self::LimitExceededException(e) => e.request_id(),
366 Self::NotFoundException(e) => e.request_id(),
367 Self::TooManyRequestsException(e) => e.request_id(),
368 Self::Unhandled(e) => e.meta.request_id(),
369 }
370 }
371}