aws_sdk_transcribestreaming/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 BadRequestException(crate::types::error::BadRequestException),
8 ConflictException(crate::types::error::ConflictException),
10 InternalFailureException(crate::types::error::InternalFailureException),
12 LimitExceededException(crate::types::error::LimitExceededException),
14 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
16 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18 variable wildcard pattern and check `.code()`:
19 \
20 `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(_) => {
34 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
35 write!(f, "unhandled error ({code})")
36 } else {
37 f.write_str("unhandled error")
38 }
39 }
40 }
41 }
42}
43impl From<::aws_smithy_types::error::operation::BuildError> for Error {
44 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
45 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
46 source: value.into(),
47 meta: ::std::default::Default::default(),
48 })
49 }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
52 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
53 match self {
54 Self::BadRequestException(inner) => inner.meta(),
55 Self::ConflictException(inner) => inner.meta(),
56 Self::InternalFailureException(inner) => inner.meta(),
57 Self::LimitExceededException(inner) => inner.meta(),
58 Self::ServiceUnavailableException(inner) => inner.meta(),
59 Self::Unhandled(inner) => &inner.meta,
60 }
61 }
62}
63impl<R>
64 From<
65 ::aws_smithy_runtime_api::client::result::SdkError<
66 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
67 R,
68 >,
69 > for Error
70where
71 R: Send + Sync + std::fmt::Debug + 'static,
72{
73 fn from(
74 err: ::aws_smithy_runtime_api::client::result::SdkError<
75 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
76 R,
77 >,
78 ) -> Self {
79 match err {
80 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
81 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
82 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
83 source: err.into(),
84 }),
85 }
86 }
87}
88impl From<crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError> for Error {
89 fn from(err: crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError) -> Self {
90 match err {
91 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ServiceUnavailableException(
92 inner,
93 ) => Error::ServiceUnavailableException(inner),
94 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::BadRequestException(inner) => {
95 Error::BadRequestException(inner)
96 }
97 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::InternalFailureException(
98 inner,
99 ) => Error::InternalFailureException(inner),
100 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::ConflictException(inner) => {
101 Error::ConflictException(inner)
102 }
103 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::LimitExceededException(
104 inner,
105 ) => Error::LimitExceededException(inner),
106 crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError::Unhandled(inner) => {
107 Error::Unhandled(inner)
108 }
109 }
110 }
111}
112impl<R>
113 From<
114 ::aws_smithy_runtime_api::client::result::SdkError<
115 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
116 R,
117 >,
118 > for Error
119where
120 R: Send + Sync + std::fmt::Debug + 'static,
121{
122 fn from(
123 err: ::aws_smithy_runtime_api::client::result::SdkError<
124 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
125 R,
126 >,
127 ) -> Self {
128 match err {
129 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
130 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
131 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
132 source: err.into(),
133 }),
134 }
135 }
136}
137impl From<crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError> for Error {
138 fn from(err: crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError) -> Self {
139 match err {
140 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ServiceUnavailableException(inner) => {
141 Error::ServiceUnavailableException(inner)
142 }
143 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::BadRequestException(inner) => {
144 Error::BadRequestException(inner)
145 }
146 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::InternalFailureException(inner) => {
147 Error::InternalFailureException(inner)
148 }
149 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::ConflictException(inner) => {
150 Error::ConflictException(inner)
151 }
152 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::LimitExceededException(inner) => {
153 Error::LimitExceededException(inner)
154 }
155 crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
156 }
157 }
158}
159impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>>
160 for Error
161where
162 R: Send + Sync + std::fmt::Debug + 'static,
163{
164 fn from(
165 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_stream_transcription::StartStreamTranscriptionError, R>,
166 ) -> Self {
167 match err {
168 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
169 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
170 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
171 source: err.into(),
172 }),
173 }
174 }
175}
176impl From<crate::operation::start_stream_transcription::StartStreamTranscriptionError> for Error {
177 fn from(err: crate::operation::start_stream_transcription::StartStreamTranscriptionError) -> Self {
178 match err {
179 crate::operation::start_stream_transcription::StartStreamTranscriptionError::ServiceUnavailableException(inner) => {
180 Error::ServiceUnavailableException(inner)
181 }
182 crate::operation::start_stream_transcription::StartStreamTranscriptionError::BadRequestException(inner) => {
183 Error::BadRequestException(inner)
184 }
185 crate::operation::start_stream_transcription::StartStreamTranscriptionError::InternalFailureException(inner) => {
186 Error::InternalFailureException(inner)
187 }
188 crate::operation::start_stream_transcription::StartStreamTranscriptionError::ConflictException(inner) => Error::ConflictException(inner),
189 crate::operation::start_stream_transcription::StartStreamTranscriptionError::LimitExceededException(inner) => {
190 Error::LimitExceededException(inner)
191 }
192 crate::operation::start_stream_transcription::StartStreamTranscriptionError::Unhandled(inner) => Error::Unhandled(inner),
193 }
194 }
195}
196impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>> for Error
197where
198 R: Send + Sync + std::fmt::Debug + 'static,
199{
200 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::AudioStreamError, R>) -> Self {
201 match err {
202 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
203 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
204 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
205 source: err.into(),
206 }),
207 }
208 }
209}
210impl From<crate::types::error::AudioStreamError> for Error {
211 fn from(err: crate::types::error::AudioStreamError) -> Self {
212 match err {
213 crate::types::error::AudioStreamError::Unhandled(inner) => Error::Unhandled(inner),
214 }
215 }
216}
217impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>> for Error
218where
219 R: Send + Sync + std::fmt::Debug + 'static,
220{
221 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::CallAnalyticsTranscriptResultStreamError, R>) -> Self {
222 match err {
223 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
224 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
225 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
226 source: err.into(),
227 }),
228 }
229 }
230}
231impl From<crate::types::error::CallAnalyticsTranscriptResultStreamError> for Error {
232 fn from(err: crate::types::error::CallAnalyticsTranscriptResultStreamError) -> Self {
233 match err {
234 crate::types::error::CallAnalyticsTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
235 crate::types::error::CallAnalyticsTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
236 crate::types::error::CallAnalyticsTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
237 crate::types::error::CallAnalyticsTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
238 crate::types::error::CallAnalyticsTranscriptResultStreamError::ServiceUnavailableException(inner) => {
239 Error::ServiceUnavailableException(inner)
240 }
241 crate::types::error::CallAnalyticsTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
242 }
243 }
244}
245impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>> for Error
246where
247 R: Send + Sync + std::fmt::Debug + 'static,
248{
249 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::MedicalTranscriptResultStreamError, R>) -> Self {
250 match err {
251 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
252 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
253 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
254 source: err.into(),
255 }),
256 }
257 }
258}
259impl From<crate::types::error::MedicalTranscriptResultStreamError> for Error {
260 fn from(err: crate::types::error::MedicalTranscriptResultStreamError) -> Self {
261 match err {
262 crate::types::error::MedicalTranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
263 crate::types::error::MedicalTranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
264 crate::types::error::MedicalTranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
265 crate::types::error::MedicalTranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
266 crate::types::error::MedicalTranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
267 crate::types::error::MedicalTranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
268 }
269 }
270}
271impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::TranscriptResultStreamError, 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::TranscriptResultStreamError, 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::TranscriptResultStreamError> for Error {
286 fn from(err: crate::types::error::TranscriptResultStreamError) -> Self {
287 match err {
288 crate::types::error::TranscriptResultStreamError::BadRequestException(inner) => Error::BadRequestException(inner),
289 crate::types::error::TranscriptResultStreamError::LimitExceededException(inner) => Error::LimitExceededException(inner),
290 crate::types::error::TranscriptResultStreamError::InternalFailureException(inner) => Error::InternalFailureException(inner),
291 crate::types::error::TranscriptResultStreamError::ConflictException(inner) => Error::ConflictException(inner),
292 crate::types::error::TranscriptResultStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
293 crate::types::error::TranscriptResultStreamError::Unhandled(inner) => Error::Unhandled(inner),
294 }
295 }
296}
297impl ::std::error::Error for Error {
298 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
299 match self {
300 Error::BadRequestException(inner) => inner.source(),
301 Error::ConflictException(inner) => inner.source(),
302 Error::InternalFailureException(inner) => inner.source(),
303 Error::LimitExceededException(inner) => inner.source(),
304 Error::ServiceUnavailableException(inner) => inner.source(),
305 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
306 }
307 }
308}
309impl ::aws_types::request_id::RequestId for Error {
310 fn request_id(&self) -> Option<&str> {
311 match self {
312 Self::BadRequestException(e) => e.request_id(),
313 Self::ConflictException(e) => e.request_id(),
314 Self::InternalFailureException(e) => e.request_id(),
315 Self::LimitExceededException(e) => e.request_id(),
316 Self::ServiceUnavailableException(e) => e.request_id(),
317 Self::Unhandled(e) => e.meta.request_id(),
318 }
319 }
320}