aws_sdk_transcribestreaming/
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>One or more arguments to the <code>StartStreamTranscription</code>, <code>StartMedicalStreamTranscription</code>, or <code>StartCallAnalyticsStreamTranscription</code> operation was not valid. For example, <code>MediaEncoding</code> or <code>LanguageCode</code> used not valid values. Check the specified parameters and try your request again.</p>
7    BadRequestException(crate::types::error::BadRequestException),
8    /// <p>A new stream started with the same session ID. The current stream has been terminated.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>A problem occurred while processing the audio. Amazon Transcribe terminated processing.</p>
11    InternalFailureException(crate::types::error::InternalFailureException),
12    /// <p>Your client has exceeded one of the Amazon Transcribe limits. This is typically the audio length limit. Break your audio stream into smaller chunks and try your request again.</p>
13    LimitExceededException(crate::types::error::LimitExceededException),
14    /// <p>The service is currently unavailable. Try your request later.</p>
15    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
16    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
17    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18    variable wildcard pattern and check `.code()`:
19     \
20    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
21     \
22    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
23    Unhandled(crate::error::sealed_unhandled::Unhandled)
24}
25impl ::std::fmt::Display for Error {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Error::BadRequestException(inner) => inner.fmt(f),
29            Error::ConflictException(inner) => inner.fmt(f),
30            Error::InternalFailureException(inner) => inner.fmt(f),
31            Error::LimitExceededException(inner) => inner.fmt(f),
32            Error::ServiceUnavailableException(inner) => inner.fmt(f),
33            Error::Unhandled(_) => if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
34                                        write!(f, "unhandled error ({code})")
35                                    } else {
36                                        f.write_str("unhandled error")
37                                    }
38        }
39    }
40}
41impl From<::aws_smithy_types::error::operation::BuildError> for Error {
42                fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
43                    Error::Unhandled(crate::error::sealed_unhandled::Unhandled { source: value.into(), meta: ::std::default::Default::default() })
44                }
45            }
46impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
47                fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
48                    match self {
49                        Self::BadRequestException(inner) => inner.meta(),
50Self::ConflictException(inner) => inner.meta(),
51Self::InternalFailureException(inner) => inner.meta(),
52Self::LimitExceededException(inner) => inner.meta(),
53Self::ServiceUnavailableException(inner) => inner.meta(),
54                        Self::Unhandled(inner) => &inner.meta,
55                    }
56                }
57            }
58impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
59    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError, R>) -> Self {
60        match err {
61            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
62            _ => Error::Unhandled(
63                                        crate::error::sealed_unhandled::Unhandled {
64                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
65                                            source: err.into(),
66                                        }
67                                    ),
68        }
69    }
70}
71impl From<crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError> for Error {
72    fn from(err: crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError) -> Self {
73        match err {
74            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
75            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::BadRequestException(inner) => Error::BadRequestException(inner),
76            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
77            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ConflictException(inner) => Error::ConflictException(inner),
78            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
79            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
80        }
81    }
82}
83impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
84    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError, R>) -> Self {
85        match err {
86            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
87            _ => Error::Unhandled(
88                                        crate::error::sealed_unhandled::Unhandled {
89                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
90                                            source: err.into(),
91                                        }
92                                    ),
93        }
94    }
95}
96impl From<crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError> for Error {
97    fn from(err: crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError) -> Self {
98        match err {
99            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
100            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::BadRequestException(inner) => Error::BadRequestException(inner),
101            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
102            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ConflictException(inner) => Error::ConflictException(inner),
103            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
104            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
105        }
106    }
107}
108impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
109    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>) -> Self {
110        match err {
111            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
112            _ => Error::Unhandled(
113                                        crate::error::sealed_unhandled::Unhandled {
114                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
115                                            source: err.into(),
116                                        }
117                                    ),
118        }
119    }
120}
121impl From<crate::operation::start_stream_transcription::StartStreamTranscriptionError> for Error {
122    fn from(err: crate::operation::start_stream_transcription::StartStreamTranscriptionError) -> Self {
123        match err {
124            crate::operation::start_stream_transcription::StartStreamTranscriptionError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
125            crate::operation::start_stream_transcription::StartStreamTranscriptionError::BadRequestException(inner) => Error::BadRequestException(inner),
126            crate::operation::start_stream_transcription::StartStreamTranscriptionError::InternalFailureException(inner) => Error::InternalFailureException(inner),
127            crate::operation::start_stream_transcription::StartStreamTranscriptionError::ConflictException(inner) => Error::ConflictException(inner),
128            crate::operation::start_stream_transcription::StartStreamTranscriptionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
129            crate::operation::start_stream_transcription::StartStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
130        }
131    }
132}
133impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
134    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>) -> Self {
135        match err {
136            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
137            _ => Error::Unhandled(
138                                        crate::error::sealed_unhandled::Unhandled {
139                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
140                                            source: err.into(),
141                                        }
142                                    ),
143        }
144    }
145}
146impl From<crate::types::error::AudioStreamError> for Error {
147    fn from(err: crate::types::error::AudioStreamError) -> Self {
148        match err {
149            crate::types::error::AudioStreamError::Unhandled(inner) => Error::Unhandled(inner),
150        }
151    }
152}
153impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
154    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>) -> Self {
155        match err {
156            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
157            _ => Error::Unhandled(
158                                        crate::error::sealed_unhandled::Unhandled {
159                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
160                                            source: err.into(),
161                                        }
162                                    ),
163        }
164    }
165}
166impl From<crate::types::error::CallAnalyticsTranscriptResultStreamError> for Error {
167    fn from(err: crate::types::error::CallAnalyticsTranscriptResultStreamError) -> Self {
168        match err {
169            crate::types::error::CallAnalyticsTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
170            crate::types::error::CallAnalyticsTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
171            crate::types::error::CallAnalyticsTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
172            crate::types::error::CallAnalyticsTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
173            crate::types::error::CallAnalyticsTranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
174            crate::types::error::CallAnalyticsTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
175        }
176    }
177}
178impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
179    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>) -> Self {
180        match err {
181            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
182            _ => Error::Unhandled(
183                                        crate::error::sealed_unhandled::Unhandled {
184                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
185                                            source: err.into(),
186                                        }
187                                    ),
188        }
189    }
190}
191impl From<crate::types::error::MedicalTranscriptResultStreamError> for Error {
192    fn from(err: crate::types::error::MedicalTranscriptResultStreamError) -> Self {
193        match err {
194            crate::types::error::MedicalTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
195            crate::types::error::MedicalTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
196            crate::types::error::MedicalTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
197            crate::types::error::MedicalTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
198            crate::types::error::MedicalTranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
199            crate::types::error::MedicalTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
200        }
201    }
202}
203impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::TranscriptResultStreamError, R>> for Error where R: Send + Sync + std::fmt::Debug + 'static {
204    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::TranscriptResultStreamError, R>) -> Self {
205        match err {
206            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
207            _ => Error::Unhandled(
208                                        crate::error::sealed_unhandled::Unhandled {
209                                            meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
210                                            source: err.into(),
211                                        }
212                                    ),
213        }
214    }
215}
216impl From<crate::types::error::TranscriptResultStreamError> for Error {
217    fn from(err: crate::types::error::TranscriptResultStreamError) -> Self {
218        match err {
219            crate::types::error::TranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
220            crate::types::error::TranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
221            crate::types::error::TranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
222            crate::types::error::TranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
223            crate::types::error::TranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
224            crate::types::error::TranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
225        }
226    }
227}
228impl ::std::error::Error for Error {
229    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
230        match self {
231            Error::BadRequestException(inner) => inner.source(),
232            Error::ConflictException(inner) => inner.source(),
233            Error::InternalFailureException(inner) => inner.source(),
234            Error::LimitExceededException(inner) => inner.source(),
235            Error::ServiceUnavailableException(inner) => inner.source(),
236            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source)
237        }
238    }
239}
240impl ::aws_types::request_id::RequestId for Error {
241    fn request_id(&self) -> Option<&str> {
242        match self {
243            Self::BadRequestException(e) => e.request_id(),
244            Self::ConflictException(e) => e.request_id(),
245            Self::InternalFailureException(e) => e.request_id(),
246            Self::LimitExceededException(e) => e.request_id(),
247            Self::ServiceUnavailableException(e) => e.request_id(),
248            Self::Unhandled(e) => e.meta.request_id(),
249        }
250    }
251}
252