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 unsupported 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 request references a resource which doesn't exist.</p>
15    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
16    /// <p>The service is currently unavailable. Try your request later.</p>
17    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
18    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
19    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20    variable wildcard pattern and check `.code()`:
21     \
22    &nbsp;&nbsp;&nbsp;`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::BadRequestException(inner) => inner.fmt(f),
31            Error::ConflictException(inner) => inner.fmt(f),
32            Error::InternalFailureException(inner) => inner.fmt(f),
33            Error::LimitExceededException(inner) => inner.fmt(f),
34            Error::ResourceNotFoundException(inner) => inner.fmt(f),
35            Error::ServiceUnavailableException(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::BadRequestException(inner) => inner.meta(),
58            Self::ConflictException(inner) => inner.meta(),
59            Self::InternalFailureException(inner) => inner.meta(),
60            Self::LimitExceededException(inner) => inner.meta(),
61            Self::ResourceNotFoundException(inner) => inner.meta(),
62            Self::ServiceUnavailableException(inner) => inner.meta(),
63            Self::Unhandled(inner) => &inner.meta,
64        }
65    }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError, R>>
68    for Error
69where
70    R: Send + Sync + std::fmt::Debug + 'static,
71{
72    fn from(
73        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError, R>,
74    ) -> Self {
75        match err {
76            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
77            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
78                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
79                source: err.into(),
80            }),
81        }
82    }
83}
84impl From<crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError> for Error {
85    fn from(err: crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError) -> Self {
86        match err {
87            crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
88            crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError::InternalFailureException(inner) => {
89                Error::InternalFailureException(inner)
90            }
91            crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError::LimitExceededException(inner) => {
92                Error::LimitExceededException(inner)
93            }
94            crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError::ResourceNotFoundException(inner) => {
95                Error::ResourceNotFoundException(inner)
96            }
97            crate::operation::get_medical_scribe_stream::GetMedicalScribeStreamError::Unhandled(inner) => Error::Unhandled(inner),
98        }
99    }
100}
101impl<R>
102    From<
103        ::aws_smithy_runtime_api::client::result::SdkError<
104            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
105            R,
106        >,
107    > for Error
108where
109    R: Send + Sync + std::fmt::Debug + 'static,
110{
111    fn from(
112        err: ::aws_smithy_runtime_api::client::result::SdkError<
113            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
114            R,
115        >,
116    ) -> Self {
117        match err {
118            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
119            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
120                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
121                source: err.into(),
122            }),
123        }
124    }
125}
126impl From<crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError> for Error {
127    fn from(err: crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError) -> Self {
128        match err {
129            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::BadRequestException(inner) => {
130                Error::BadRequestException(inner)
131            }
132            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ConflictException(inner) => {
133                Error::ConflictException(inner)
134            }
135            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::InternalFailureException(
136                inner,
137            ) => Error::InternalFailureException(inner),
138            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::LimitExceededException(
139                inner,
140            ) => Error::LimitExceededException(inner),
141            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ServiceUnavailableException(
142                inner,
143            ) => Error::ServiceUnavailableException(inner),
144            crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::Unhandled(inner) => {
145                Error::Unhandled(inner)
146            }
147        }
148    }
149}
150impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError, R>>
151    for Error
152where
153    R: Send + Sync + std::fmt::Debug + 'static,
154{
155    fn from(
156        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError, R>,
157    ) -> Self {
158        match err {
159            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
160            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
161                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
162                source: err.into(),
163            }),
164        }
165    }
166}
167impl From<crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError> for Error {
168    fn from(err: crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError) -> Self {
169        match err {
170            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::BadRequestException(inner) => {
171                Error::BadRequestException(inner)
172            }
173            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::ConflictException(inner) => Error::ConflictException(inner),
174            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::InternalFailureException(inner) => {
175                Error::InternalFailureException(inner)
176            }
177            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::LimitExceededException(inner) => {
178                Error::LimitExceededException(inner)
179            }
180            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::ServiceUnavailableException(inner) => {
181                Error::ServiceUnavailableException(inner)
182            }
183            crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError::Unhandled(inner) => Error::Unhandled(inner),
184        }
185    }
186}
187impl<R>
188    From<
189        ::aws_smithy_runtime_api::client::result::SdkError<
190            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
191            R,
192        >,
193    > for Error
194where
195    R: Send + Sync + std::fmt::Debug + 'static,
196{
197    fn from(
198        err: ::aws_smithy_runtime_api::client::result::SdkError<
199            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
200            R,
201        >,
202    ) -> Self {
203        match err {
204            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
205            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
206                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
207                source: err.into(),
208            }),
209        }
210    }
211}
212impl From<crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError> for Error {
213    fn from(err: crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError) -> Self {
214        match err {
215            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::BadRequestException(inner) => {
216                Error::BadRequestException(inner)
217            }
218            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ConflictException(inner) => {
219                Error::ConflictException(inner)
220            }
221            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::InternalFailureException(inner) => {
222                Error::InternalFailureException(inner)
223            }
224            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::LimitExceededException(inner) => {
225                Error::LimitExceededException(inner)
226            }
227            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ServiceUnavailableException(inner) => {
228                Error::ServiceUnavailableException(inner)
229            }
230            crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
231        }
232    }
233}
234impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>>
235    for Error
236where
237    R: Send + Sync + std::fmt::Debug + 'static,
238{
239    fn from(
240        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>,
241    ) -> Self {
242        match err {
243            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
244            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
245                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
246                source: err.into(),
247            }),
248        }
249    }
250}
251impl From<crate::operation::start_stream_transcription::StartStreamTranscriptionError> for Error {
252    fn from(err: crate::operation::start_stream_transcription::StartStreamTranscriptionError) -> Self {
253        match err {
254            crate::operation::start_stream_transcription::StartStreamTranscriptionError::BadRequestException(inner) => {
255                Error::BadRequestException(inner)
256            }
257            crate::operation::start_stream_transcription::StartStreamTranscriptionError::ConflictException(inner) => Error::ConflictException(inner),
258            crate::operation::start_stream_transcription::StartStreamTranscriptionError::InternalFailureException(inner) => {
259                Error::InternalFailureException(inner)
260            }
261            crate::operation::start_stream_transcription::StartStreamTranscriptionError::LimitExceededException(inner) => {
262                Error::LimitExceededException(inner)
263            }
264            crate::operation::start_stream_transcription::StartStreamTranscriptionError::ServiceUnavailableException(inner) => {
265                Error::ServiceUnavailableException(inner)
266            }
267            crate::operation::start_stream_transcription::StartStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
268        }
269    }
270}
271impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>> for Error
272where
273    R: Send + Sync + std::fmt::Debug + 'static,
274{
275    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>) -> Self {
276        match err {
277            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
278            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
279                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
280                source: err.into(),
281            }),
282        }
283    }
284}
285impl From<crate::types::error::AudioStreamError> for Error {
286    fn from(err: crate::types::error::AudioStreamError) -> Self {
287        match err {
288            crate::types::error::AudioStreamError::Unhandled(inner) => Error::Unhandled(inner),
289        }
290    }
291}
292impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>> for Error
293where
294    R: Send + Sync + std::fmt::Debug + 'static,
295{
296    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>) -> Self {
297        match err {
298            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
299            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
300                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
301                source: err.into(),
302            }),
303        }
304    }
305}
306impl From<crate::types::error::CallAnalyticsTranscriptResultStreamError> for Error {
307    fn from(err: crate::types::error::CallAnalyticsTranscriptResultStreamError) -> Self {
308        match err {
309            crate::types::error::CallAnalyticsTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
310            crate::types::error::CallAnalyticsTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
311            crate::types::error::CallAnalyticsTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
312            crate::types::error::CallAnalyticsTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
313            crate::types::error::CallAnalyticsTranscriptResultStreamError::ServiceUnavailableException(inner) => {
314                Error::ServiceUnavailableException(inner)
315            }
316            crate::types::error::CallAnalyticsTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
317        }
318    }
319}
320impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalScribeInputStreamError, R>> for Error
321where
322    R: Send + Sync + std::fmt::Debug + 'static,
323{
324    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalScribeInputStreamError, R>) -> Self {
325        match err {
326            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
327            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
328                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
329                source: err.into(),
330            }),
331        }
332    }
333}
334impl From<crate::types::error::MedicalScribeInputStreamError> for Error {
335    fn from(err: crate::types::error::MedicalScribeInputStreamError) -> Self {
336        match err {
337            crate::types::error::MedicalScribeInputStreamError::Unhandled(inner) => Error::Unhandled(inner),
338        }
339    }
340}
341impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalScribeResultStreamError, R>> for Error
342where
343    R: Send + Sync + std::fmt::Debug + 'static,
344{
345    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalScribeResultStreamError, R>) -> Self {
346        match err {
347            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
348            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
349                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
350                source: err.into(),
351            }),
352        }
353    }
354}
355impl From<crate::types::error::MedicalScribeResultStreamError> for Error {
356    fn from(err: crate::types::error::MedicalScribeResultStreamError) -> Self {
357        match err {
358            crate::types::error::MedicalScribeResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
359            crate::types::error::MedicalScribeResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
360            crate::types::error::MedicalScribeResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
361            crate::types::error::MedicalScribeResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
362            crate::types::error::MedicalScribeResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
363            crate::types::error::MedicalScribeResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
364        }
365    }
366}
367impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>> for Error
368where
369    R: Send + Sync + std::fmt::Debug + 'static,
370{
371    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>) -> Self {
372        match err {
373            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
374            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
375                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
376                source: err.into(),
377            }),
378        }
379    }
380}
381impl From<crate::types::error::MedicalTranscriptResultStreamError> for Error {
382    fn from(err: crate::types::error::MedicalTranscriptResultStreamError) -> Self {
383        match err {
384            crate::types::error::MedicalTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
385            crate::types::error::MedicalTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
386            crate::types::error::MedicalTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
387            crate::types::error::MedicalTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
388            crate::types::error::MedicalTranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
389            crate::types::error::MedicalTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
390        }
391    }
392}
393impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::TranscriptResultStreamError, R>> for Error
394where
395    R: Send + Sync + std::fmt::Debug + 'static,
396{
397    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::TranscriptResultStreamError, R>) -> Self {
398        match err {
399            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
400            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
401                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
402                source: err.into(),
403            }),
404        }
405    }
406}
407impl From<crate::types::error::TranscriptResultStreamError> for Error {
408    fn from(err: crate::types::error::TranscriptResultStreamError) -> Self {
409        match err {
410            crate::types::error::TranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
411            crate::types::error::TranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
412            crate::types::error::TranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
413            crate::types::error::TranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
414            crate::types::error::TranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
415            crate::types::error::TranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
416        }
417    }
418}
419impl ::std::error::Error for Error {
420    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
421        match self {
422            Error::BadRequestException(inner) => inner.source(),
423            Error::ConflictException(inner) => inner.source(),
424            Error::InternalFailureException(inner) => inner.source(),
425            Error::LimitExceededException(inner) => inner.source(),
426            Error::ResourceNotFoundException(inner) => inner.source(),
427            Error::ServiceUnavailableException(inner) => inner.source(),
428            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
429        }
430    }
431}
432impl ::aws_types::request_id::RequestId for Error {
433    fn request_id(&self) -> Option<&str> {
434        match self {
435            Self::BadRequestException(e) => e.request_id(),
436            Self::ConflictException(e) => e.request_id(),
437            Self::InternalFailureException(e) => e.request_id(),
438            Self::LimitExceededException(e) => e.request_id(),
439            Self::ResourceNotFoundException(e) => e.request_id(),
440            Self::ServiceUnavailableException(e) => e.request_id(),
441            Self::Unhandled(e) => e.meta.request_id(),
442        }
443    }
444}