1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 BadGatewayException(crate::types::error::BadGatewayException),
10 ConflictException(crate::types::error::ConflictException),
12 DependencyFailedException(crate::types::error::DependencyFailedException),
14 InternalServerException(crate::types::error::InternalServerException),
16 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
18 ThrottlingException(crate::types::error::ThrottlingException),
20 ValidationException(crate::types::error::ValidationException),
22 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
24 variable wildcard pattern and check `.code()`:
25 \
26 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
27 \
28 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
29 Unhandled(crate::error::sealed_unhandled::Unhandled),
30}
31impl ::std::fmt::Display for Error {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 match self {
34 Error::AccessDeniedException(inner) => inner.fmt(f),
35 Error::BadGatewayException(inner) => inner.fmt(f),
36 Error::ConflictException(inner) => inner.fmt(f),
37 Error::DependencyFailedException(inner) => inner.fmt(f),
38 Error::InternalServerException(inner) => inner.fmt(f),
39 Error::ResourceNotFoundException(inner) => inner.fmt(f),
40 Error::ThrottlingException(inner) => inner.fmt(f),
41 Error::ValidationException(inner) => inner.fmt(f),
42 Error::Unhandled(_) => {
43 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
44 write!(f, "unhandled error ({code})")
45 } else {
46 f.write_str("unhandled error")
47 }
48 }
49 }
50 }
51}
52impl From<::aws_smithy_types::error::operation::BuildError> for Error {
53 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
54 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
55 source: value.into(),
56 meta: ::std::default::Default::default(),
57 })
58 }
59}
60impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
61 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
62 match self {
63 Self::AccessDeniedException(inner) => inner.meta(),
64 Self::BadGatewayException(inner) => inner.meta(),
65 Self::ConflictException(inner) => inner.meta(),
66 Self::DependencyFailedException(inner) => inner.meta(),
67 Self::InternalServerException(inner) => inner.meta(),
68 Self::ResourceNotFoundException(inner) => inner.meta(),
69 Self::ThrottlingException(inner) => inner.meta(),
70 Self::ValidationException(inner) => inner.meta(),
71 Self::Unhandled(inner) => &inner.meta,
72 }
73 }
74}
75impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_session::DeleteSessionError, R>> for Error
76where
77 R: Send + Sync + std::fmt::Debug + 'static,
78{
79 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_session::DeleteSessionError, R>) -> Self {
80 match err {
81 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
82 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
83 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
84 source: err.into(),
85 }),
86 }
87 }
88}
89impl From<crate::operation::delete_session::DeleteSessionError> for Error {
90 fn from(err: crate::operation::delete_session::DeleteSessionError) -> Self {
91 match err {
92 crate::operation::delete_session::DeleteSessionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
93 crate::operation::delete_session::DeleteSessionError::ConflictException(inner) => Error::ConflictException(inner),
94 crate::operation::delete_session::DeleteSessionError::InternalServerException(inner) => Error::InternalServerException(inner),
95 crate::operation::delete_session::DeleteSessionError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
96 crate::operation::delete_session::DeleteSessionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
97 crate::operation::delete_session::DeleteSessionError::ValidationException(inner) => Error::ValidationException(inner),
98 crate::operation::delete_session::DeleteSessionError::Unhandled(inner) => Error::Unhandled(inner),
99 }
100 }
101}
102impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session::GetSessionError, R>> for Error
103where
104 R: Send + Sync + std::fmt::Debug + 'static,
105{
106 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session::GetSessionError, R>) -> Self {
107 match err {
108 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
109 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
110 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
111 source: err.into(),
112 }),
113 }
114 }
115}
116impl From<crate::operation::get_session::GetSessionError> for Error {
117 fn from(err: crate::operation::get_session::GetSessionError) -> Self {
118 match err {
119 crate::operation::get_session::GetSessionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
120 crate::operation::get_session::GetSessionError::InternalServerException(inner) => Error::InternalServerException(inner),
121 crate::operation::get_session::GetSessionError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
122 crate::operation::get_session::GetSessionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
123 crate::operation::get_session::GetSessionError::ValidationException(inner) => Error::ValidationException(inner),
124 crate::operation::get_session::GetSessionError::Unhandled(inner) => Error::Unhandled(inner),
125 }
126 }
127}
128impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_session::PutSessionError, R>> for Error
129where
130 R: Send + Sync + std::fmt::Debug + 'static,
131{
132 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_session::PutSessionError, R>) -> Self {
133 match err {
134 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
135 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
136 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
137 source: err.into(),
138 }),
139 }
140 }
141}
142impl From<crate::operation::put_session::PutSessionError> for Error {
143 fn from(err: crate::operation::put_session::PutSessionError) -> Self {
144 match err {
145 crate::operation::put_session::PutSessionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
146 crate::operation::put_session::PutSessionError::BadGatewayException(inner) => Error::BadGatewayException(inner),
147 crate::operation::put_session::PutSessionError::ConflictException(inner) => Error::ConflictException(inner),
148 crate::operation::put_session::PutSessionError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
149 crate::operation::put_session::PutSessionError::InternalServerException(inner) => Error::InternalServerException(inner),
150 crate::operation::put_session::PutSessionError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
151 crate::operation::put_session::PutSessionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
152 crate::operation::put_session::PutSessionError::ValidationException(inner) => Error::ValidationException(inner),
153 crate::operation::put_session::PutSessionError::Unhandled(inner) => Error::Unhandled(inner),
154 }
155 }
156}
157impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::recognize_text::RecognizeTextError, R>> for Error
158where
159 R: Send + Sync + std::fmt::Debug + 'static,
160{
161 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::recognize_text::RecognizeTextError, R>) -> Self {
162 match err {
163 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
164 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
165 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
166 source: err.into(),
167 }),
168 }
169 }
170}
171impl From<crate::operation::recognize_text::RecognizeTextError> for Error {
172 fn from(err: crate::operation::recognize_text::RecognizeTextError) -> Self {
173 match err {
174 crate::operation::recognize_text::RecognizeTextError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
175 crate::operation::recognize_text::RecognizeTextError::BadGatewayException(inner) => Error::BadGatewayException(inner),
176 crate::operation::recognize_text::RecognizeTextError::ConflictException(inner) => Error::ConflictException(inner),
177 crate::operation::recognize_text::RecognizeTextError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
178 crate::operation::recognize_text::RecognizeTextError::InternalServerException(inner) => Error::InternalServerException(inner),
179 crate::operation::recognize_text::RecognizeTextError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
180 crate::operation::recognize_text::RecognizeTextError::ThrottlingException(inner) => Error::ThrottlingException(inner),
181 crate::operation::recognize_text::RecognizeTextError::ValidationException(inner) => Error::ValidationException(inner),
182 crate::operation::recognize_text::RecognizeTextError::Unhandled(inner) => Error::Unhandled(inner),
183 }
184 }
185}
186impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::recognize_utterance::RecognizeUtteranceError, 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::recognize_utterance::RecognizeUtteranceError, 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::recognize_utterance::RecognizeUtteranceError> for Error {
201 fn from(err: crate::operation::recognize_utterance::RecognizeUtteranceError) -> Self {
202 match err {
203 crate::operation::recognize_utterance::RecognizeUtteranceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
204 crate::operation::recognize_utterance::RecognizeUtteranceError::BadGatewayException(inner) => Error::BadGatewayException(inner),
205 crate::operation::recognize_utterance::RecognizeUtteranceError::ConflictException(inner) => Error::ConflictException(inner),
206 crate::operation::recognize_utterance::RecognizeUtteranceError::DependencyFailedException(inner) => {
207 Error::DependencyFailedException(inner)
208 }
209 crate::operation::recognize_utterance::RecognizeUtteranceError::InternalServerException(inner) => Error::InternalServerException(inner),
210 crate::operation::recognize_utterance::RecognizeUtteranceError::ResourceNotFoundException(inner) => {
211 Error::ResourceNotFoundException(inner)
212 }
213 crate::operation::recognize_utterance::RecognizeUtteranceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
214 crate::operation::recognize_utterance::RecognizeUtteranceError::ValidationException(inner) => Error::ValidationException(inner),
215 crate::operation::recognize_utterance::RecognizeUtteranceError::Unhandled(inner) => Error::Unhandled(inner),
216 }
217 }
218}
219impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_conversation::StartConversationError, R>> for Error
220where
221 R: Send + Sync + std::fmt::Debug + 'static,
222{
223 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_conversation::StartConversationError, R>) -> 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::start_conversation::StartConversationError> for Error {
234 fn from(err: crate::operation::start_conversation::StartConversationError) -> Self {
235 match err {
236 crate::operation::start_conversation::StartConversationError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
237 crate::operation::start_conversation::StartConversationError::InternalServerException(inner) => Error::InternalServerException(inner),
238 crate::operation::start_conversation::StartConversationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
239 crate::operation::start_conversation::StartConversationError::ValidationException(inner) => Error::ValidationException(inner),
240 crate::operation::start_conversation::StartConversationError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
241 crate::operation::start_conversation::StartConversationError::ConflictException(inner) => Error::ConflictException(inner),
242 crate::operation::start_conversation::StartConversationError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
243 crate::operation::start_conversation::StartConversationError::BadGatewayException(inner) => Error::BadGatewayException(inner),
244 crate::operation::start_conversation::StartConversationError::Unhandled(inner) => Error::Unhandled(inner),
245 }
246 }
247}
248impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::StartConversationRequestEventStreamError, 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::types::error::StartConversationRequestEventStreamError, 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::types::error::StartConversationRequestEventStreamError> for Error {
263 fn from(err: crate::types::error::StartConversationRequestEventStreamError) -> Self {
264 match err {
265 crate::types::error::StartConversationRequestEventStreamError::Unhandled(inner) => Error::Unhandled(inner),
266 }
267 }
268}
269impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::StartConversationResponseEventStreamError, R>> for Error
270where
271 R: Send + Sync + std::fmt::Debug + 'static,
272{
273 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::StartConversationResponseEventStreamError, R>) -> Self {
274 match err {
275 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
276 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
277 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
278 source: err.into(),
279 }),
280 }
281 }
282}
283impl From<crate::types::error::StartConversationResponseEventStreamError> for Error {
284 fn from(err: crate::types::error::StartConversationResponseEventStreamError) -> Self {
285 match err {
286 crate::types::error::StartConversationResponseEventStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
287 crate::types::error::StartConversationResponseEventStreamError::ResourceNotFoundException(inner) => {
288 Error::ResourceNotFoundException(inner)
289 }
290 crate::types::error::StartConversationResponseEventStreamError::ValidationException(inner) => Error::ValidationException(inner),
291 crate::types::error::StartConversationResponseEventStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
292 crate::types::error::StartConversationResponseEventStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
293 crate::types::error::StartConversationResponseEventStreamError::ConflictException(inner) => Error::ConflictException(inner),
294 crate::types::error::StartConversationResponseEventStreamError::DependencyFailedException(inner) => {
295 Error::DependencyFailedException(inner)
296 }
297 crate::types::error::StartConversationResponseEventStreamError::BadGatewayException(inner) => Error::BadGatewayException(inner),
298 crate::types::error::StartConversationResponseEventStreamError::Unhandled(inner) => Error::Unhandled(inner),
299 }
300 }
301}
302impl ::std::error::Error for Error {
303 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
304 match self {
305 Error::AccessDeniedException(inner) => inner.source(),
306 Error::BadGatewayException(inner) => inner.source(),
307 Error::ConflictException(inner) => inner.source(),
308 Error::DependencyFailedException(inner) => inner.source(),
309 Error::InternalServerException(inner) => inner.source(),
310 Error::ResourceNotFoundException(inner) => inner.source(),
311 Error::ThrottlingException(inner) => inner.source(),
312 Error::ValidationException(inner) => inner.source(),
313 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
314 }
315 }
316}
317impl ::aws_types::request_id::RequestId for Error {
318 fn request_id(&self) -> Option<&str> {
319 match self {
320 Self::AccessDeniedException(e) => e.request_id(),
321 Self::BadGatewayException(e) => e.request_id(),
322 Self::ConflictException(e) => e.request_id(),
323 Self::DependencyFailedException(e) => e.request_id(),
324 Self::InternalServerException(e) => e.request_id(),
325 Self::ResourceNotFoundException(e) => e.request_id(),
326 Self::ThrottlingException(e) => e.request_id(),
327 Self::ValidationException(e) => e.request_id(),
328 Self::Unhandled(e) => e.meta.request_id(),
329 }
330 }
331}