aws_sdk_lexruntime/
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>Either the Amazon Lex bot is still building, or one of the dependent services (Amazon Polly, AWS Lambda) failed with an internal service error.</p>
7    BadGatewayException(crate::types::error::BadGatewayException),
8    /// <p>Request validation failed, there is no usable message in the context, or the bot build failed, is still in progress, or contains unbuilt changes.</p>
9    BadRequestException(crate::types::error::BadRequestException),
10    /// <p>Two clients are using the same AWS account, Amazon Lex bot, and user ID.</p>
11    ConflictException(crate::types::error::ConflictException),
12    /// <p>One of the dependencies, such as AWS Lambda or Amazon Polly, threw an exception. For example,</p>
13    /// <ul>
14    /// <li>
15    /// <p>If Amazon Lex does not have sufficient permissions to call a Lambda function.</p></li>
16    /// <li>
17    /// <p>If a Lambda function takes longer than 30 seconds to execute.</p></li>
18    /// <li>
19    /// <p>If a fulfillment Lambda function returns a <code>Delegate</code> dialog action without removing any slot values.</p></li>
20    /// </ul>
21    DependencyFailedException(crate::types::error::DependencyFailedException),
22    /// <p>Internal service error. Retry the call.</p>
23    InternalFailureException(crate::types::error::InternalFailureException),
24    /// <p>Exceeded a limit.</p>
25    LimitExceededException(crate::types::error::LimitExceededException),
26    /// <p>This exception is not used.</p>
27    LoopDetectedException(crate::types::error::LoopDetectedException),
28    /// <p>The accept header in the request does not have a valid value.</p>
29    NotAcceptableException(crate::types::error::NotAcceptableException),
30    /// <p>The resource (such as the Amazon Lex bot or an alias) that is referred to is not found.</p>
31    NotFoundException(crate::types::error::NotFoundException),
32    /// <p>The input speech is too long.</p>
33    RequestTimeoutException(crate::types::error::RequestTimeoutException),
34    /// <p>The Content-Type header (<code>PostContent</code> API) has an invalid value.</p>
35    UnsupportedMediaTypeException(crate::types::error::UnsupportedMediaTypeException),
36    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
37    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
38    variable wildcard pattern and check `.code()`:
39     \
40    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
41     \
42    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
43    Unhandled(crate::error::sealed_unhandled::Unhandled),
44}
45impl ::std::fmt::Display for Error {
46    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47        match self {
48            Error::BadGatewayException(inner) => inner.fmt(f),
49            Error::BadRequestException(inner) => inner.fmt(f),
50            Error::ConflictException(inner) => inner.fmt(f),
51            Error::DependencyFailedException(inner) => inner.fmt(f),
52            Error::InternalFailureException(inner) => inner.fmt(f),
53            Error::LimitExceededException(inner) => inner.fmt(f),
54            Error::LoopDetectedException(inner) => inner.fmt(f),
55            Error::NotAcceptableException(inner) => inner.fmt(f),
56            Error::NotFoundException(inner) => inner.fmt(f),
57            Error::RequestTimeoutException(inner) => inner.fmt(f),
58            Error::UnsupportedMediaTypeException(inner) => inner.fmt(f),
59            Error::Unhandled(_) => {
60                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
61                    write!(f, "unhandled error ({code})")
62                } else {
63                    f.write_str("unhandled error")
64                }
65            }
66        }
67    }
68}
69impl From<::aws_smithy_types::error::operation::BuildError> for Error {
70    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
71        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
72            source: value.into(),
73            meta: ::std::default::Default::default(),
74        })
75    }
76}
77impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
78    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
79        match self {
80            Self::BadGatewayException(inner) => inner.meta(),
81            Self::BadRequestException(inner) => inner.meta(),
82            Self::ConflictException(inner) => inner.meta(),
83            Self::DependencyFailedException(inner) => inner.meta(),
84            Self::InternalFailureException(inner) => inner.meta(),
85            Self::LimitExceededException(inner) => inner.meta(),
86            Self::LoopDetectedException(inner) => inner.meta(),
87            Self::NotAcceptableException(inner) => inner.meta(),
88            Self::NotFoundException(inner) => inner.meta(),
89            Self::RequestTimeoutException(inner) => inner.meta(),
90            Self::UnsupportedMediaTypeException(inner) => inner.meta(),
91            Self::Unhandled(inner) => &inner.meta,
92        }
93    }
94}
95impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_session::DeleteSessionError, R>> for Error
96where
97    R: Send + Sync + std::fmt::Debug + 'static,
98{
99    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_session::DeleteSessionError, R>) -> Self {
100        match err {
101            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
102            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
103                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
104                source: err.into(),
105            }),
106        }
107    }
108}
109impl From<crate::operation::delete_session::DeleteSessionError> for Error {
110    fn from(err: crate::operation::delete_session::DeleteSessionError) -> Self {
111        match err {
112            crate::operation::delete_session::DeleteSessionError::BadRequestException(inner) => Error::BadRequestException(inner),
113            crate::operation::delete_session::DeleteSessionError::ConflictException(inner) => Error::ConflictException(inner),
114            crate::operation::delete_session::DeleteSessionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
115            crate::operation::delete_session::DeleteSessionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
116            crate::operation::delete_session::DeleteSessionError::NotFoundException(inner) => Error::NotFoundException(inner),
117            crate::operation::delete_session::DeleteSessionError::Unhandled(inner) => Error::Unhandled(inner),
118        }
119    }
120}
121impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session::GetSessionError, R>> for Error
122where
123    R: Send + Sync + std::fmt::Debug + 'static,
124{
125    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_session::GetSessionError, R>) -> Self {
126        match err {
127            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
128            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
129                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
130                source: err.into(),
131            }),
132        }
133    }
134}
135impl From<crate::operation::get_session::GetSessionError> for Error {
136    fn from(err: crate::operation::get_session::GetSessionError) -> Self {
137        match err {
138            crate::operation::get_session::GetSessionError::BadRequestException(inner) => Error::BadRequestException(inner),
139            crate::operation::get_session::GetSessionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
140            crate::operation::get_session::GetSessionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
141            crate::operation::get_session::GetSessionError::NotFoundException(inner) => Error::NotFoundException(inner),
142            crate::operation::get_session::GetSessionError::Unhandled(inner) => Error::Unhandled(inner),
143        }
144    }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_content::PostContentError, R>> for Error
147where
148    R: Send + Sync + std::fmt::Debug + 'static,
149{
150    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_content::PostContentError, R>) -> Self {
151        match err {
152            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
154                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
155                source: err.into(),
156            }),
157        }
158    }
159}
160impl From<crate::operation::post_content::PostContentError> for Error {
161    fn from(err: crate::operation::post_content::PostContentError) -> Self {
162        match err {
163            crate::operation::post_content::PostContentError::BadGatewayException(inner) => Error::BadGatewayException(inner),
164            crate::operation::post_content::PostContentError::BadRequestException(inner) => Error::BadRequestException(inner),
165            crate::operation::post_content::PostContentError::ConflictException(inner) => Error::ConflictException(inner),
166            crate::operation::post_content::PostContentError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
167            crate::operation::post_content::PostContentError::InternalFailureException(inner) => Error::InternalFailureException(inner),
168            crate::operation::post_content::PostContentError::LimitExceededException(inner) => Error::LimitExceededException(inner),
169            crate::operation::post_content::PostContentError::LoopDetectedException(inner) => Error::LoopDetectedException(inner),
170            crate::operation::post_content::PostContentError::NotAcceptableException(inner) => Error::NotAcceptableException(inner),
171            crate::operation::post_content::PostContentError::NotFoundException(inner) => Error::NotFoundException(inner),
172            crate::operation::post_content::PostContentError::RequestTimeoutException(inner) => Error::RequestTimeoutException(inner),
173            crate::operation::post_content::PostContentError::UnsupportedMediaTypeException(inner) => Error::UnsupportedMediaTypeException(inner),
174            crate::operation::post_content::PostContentError::Unhandled(inner) => Error::Unhandled(inner),
175        }
176    }
177}
178impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_text::PostTextError, R>> for Error
179where
180    R: Send + Sync + std::fmt::Debug + 'static,
181{
182    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_text::PostTextError, R>) -> Self {
183        match err {
184            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
185            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
186                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
187                source: err.into(),
188            }),
189        }
190    }
191}
192impl From<crate::operation::post_text::PostTextError> for Error {
193    fn from(err: crate::operation::post_text::PostTextError) -> Self {
194        match err {
195            crate::operation::post_text::PostTextError::BadGatewayException(inner) => Error::BadGatewayException(inner),
196            crate::operation::post_text::PostTextError::BadRequestException(inner) => Error::BadRequestException(inner),
197            crate::operation::post_text::PostTextError::ConflictException(inner) => Error::ConflictException(inner),
198            crate::operation::post_text::PostTextError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
199            crate::operation::post_text::PostTextError::InternalFailureException(inner) => Error::InternalFailureException(inner),
200            crate::operation::post_text::PostTextError::LimitExceededException(inner) => Error::LimitExceededException(inner),
201            crate::operation::post_text::PostTextError::LoopDetectedException(inner) => Error::LoopDetectedException(inner),
202            crate::operation::post_text::PostTextError::NotFoundException(inner) => Error::NotFoundException(inner),
203            crate::operation::post_text::PostTextError::Unhandled(inner) => Error::Unhandled(inner),
204        }
205    }
206}
207impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_session::PutSessionError, R>> for Error
208where
209    R: Send + Sync + std::fmt::Debug + 'static,
210{
211    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_session::PutSessionError, R>) -> Self {
212        match err {
213            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
214            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
215                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
216                source: err.into(),
217            }),
218        }
219    }
220}
221impl From<crate::operation::put_session::PutSessionError> for Error {
222    fn from(err: crate::operation::put_session::PutSessionError) -> Self {
223        match err {
224            crate::operation::put_session::PutSessionError::BadGatewayException(inner) => Error::BadGatewayException(inner),
225            crate::operation::put_session::PutSessionError::BadRequestException(inner) => Error::BadRequestException(inner),
226            crate::operation::put_session::PutSessionError::ConflictException(inner) => Error::ConflictException(inner),
227            crate::operation::put_session::PutSessionError::DependencyFailedException(inner) => Error::DependencyFailedException(inner),
228            crate::operation::put_session::PutSessionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
229            crate::operation::put_session::PutSessionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
230            crate::operation::put_session::PutSessionError::NotAcceptableException(inner) => Error::NotAcceptableException(inner),
231            crate::operation::put_session::PutSessionError::NotFoundException(inner) => Error::NotFoundException(inner),
232            crate::operation::put_session::PutSessionError::Unhandled(inner) => Error::Unhandled(inner),
233        }
234    }
235}
236impl ::std::error::Error for Error {
237    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
238        match self {
239            Error::BadGatewayException(inner) => inner.source(),
240            Error::BadRequestException(inner) => inner.source(),
241            Error::ConflictException(inner) => inner.source(),
242            Error::DependencyFailedException(inner) => inner.source(),
243            Error::InternalFailureException(inner) => inner.source(),
244            Error::LimitExceededException(inner) => inner.source(),
245            Error::LoopDetectedException(inner) => inner.source(),
246            Error::NotAcceptableException(inner) => inner.source(),
247            Error::NotFoundException(inner) => inner.source(),
248            Error::RequestTimeoutException(inner) => inner.source(),
249            Error::UnsupportedMediaTypeException(inner) => inner.source(),
250            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
251        }
252    }
253}
254impl ::aws_types::request_id::RequestId for Error {
255    fn request_id(&self) -> Option<&str> {
256        match self {
257            Self::BadGatewayException(e) => e.request_id(),
258            Self::BadRequestException(e) => e.request_id(),
259            Self::ConflictException(e) => e.request_id(),
260            Self::DependencyFailedException(e) => e.request_id(),
261            Self::InternalFailureException(e) => e.request_id(),
262            Self::LimitExceededException(e) => e.request_id(),
263            Self::LoopDetectedException(e) => e.request_id(),
264            Self::NotAcceptableException(e) => e.request_id(),
265            Self::NotFoundException(e) => e.request_id(),
266            Self::RequestTimeoutException(e) => e.request_id(),
267            Self::UnsupportedMediaTypeException(e) => e.request_id(),
268            Self::Unhandled(e) => e.meta.request_id(),
269        }
270    }
271}