1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 ConflictException(crate::types::error::ConflictException),
10 InternalServerException(crate::types::error::InternalServerException),
12 ModelErrorException(crate::types::error::ModelErrorException),
14 ModelNotReadyException(crate::types::error::ModelNotReadyException),
16 ModelStreamErrorException(crate::types::error::ModelStreamErrorException),
18 ModelTimeoutException(crate::types::error::ModelTimeoutException),
20 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
22 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
24 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
26 ThrottlingException(crate::types::error::ThrottlingException),
28 ValidationException(crate::types::error::ValidationException),
30 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
32 variable wildcard pattern and check `.code()`:
33 \
34 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
35 \
36 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
37 Unhandled(crate::error::sealed_unhandled::Unhandled),
38}
39impl ::std::fmt::Display for Error {
40 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41 match self {
42 Error::AccessDeniedException(inner) => inner.fmt(f),
43 Error::ConflictException(inner) => inner.fmt(f),
44 Error::InternalServerException(inner) => inner.fmt(f),
45 Error::ModelErrorException(inner) => inner.fmt(f),
46 Error::ModelNotReadyException(inner) => inner.fmt(f),
47 Error::ModelStreamErrorException(inner) => inner.fmt(f),
48 Error::ModelTimeoutException(inner) => inner.fmt(f),
49 Error::ResourceNotFoundException(inner) => inner.fmt(f),
50 Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
51 Error::ServiceUnavailableException(inner) => inner.fmt(f),
52 Error::ThrottlingException(inner) => inner.fmt(f),
53 Error::ValidationException(inner) => inner.fmt(f),
54 Error::Unhandled(_) => {
55 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
56 write!(f, "unhandled error ({code})")
57 } else {
58 f.write_str("unhandled error")
59 }
60 }
61 }
62 }
63}
64impl From<::aws_smithy_types::error::operation::BuildError> for Error {
65 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
66 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
67 source: value.into(),
68 meta: ::std::default::Default::default(),
69 })
70 }
71}
72impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
73 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
74 match self {
75 Self::AccessDeniedException(inner) => inner.meta(),
76 Self::ConflictException(inner) => inner.meta(),
77 Self::InternalServerException(inner) => inner.meta(),
78 Self::ModelErrorException(inner) => inner.meta(),
79 Self::ModelNotReadyException(inner) => inner.meta(),
80 Self::ModelStreamErrorException(inner) => inner.meta(),
81 Self::ModelTimeoutException(inner) => inner.meta(),
82 Self::ResourceNotFoundException(inner) => inner.meta(),
83 Self::ServiceQuotaExceededException(inner) => inner.meta(),
84 Self::ServiceUnavailableException(inner) => inner.meta(),
85 Self::ThrottlingException(inner) => inner.meta(),
86 Self::ValidationException(inner) => inner.meta(),
87 Self::Unhandled(inner) => &inner.meta,
88 }
89 }
90}
91impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::apply_guardrail::ApplyGuardrailError, R>> for Error
92where
93 R: Send + Sync + std::fmt::Debug + 'static,
94{
95 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::apply_guardrail::ApplyGuardrailError, R>) -> Self {
96 match err {
97 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
98 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
99 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
100 source: err.into(),
101 }),
102 }
103 }
104}
105impl From<crate::operation::apply_guardrail::ApplyGuardrailError> for Error {
106 fn from(err: crate::operation::apply_guardrail::ApplyGuardrailError) -> Self {
107 match err {
108 crate::operation::apply_guardrail::ApplyGuardrailError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
109 crate::operation::apply_guardrail::ApplyGuardrailError::InternalServerException(inner) => Error::InternalServerException(inner),
110 crate::operation::apply_guardrail::ApplyGuardrailError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
111 crate::operation::apply_guardrail::ApplyGuardrailError::ServiceQuotaExceededException(inner) => {
112 Error::ServiceQuotaExceededException(inner)
113 }
114 crate::operation::apply_guardrail::ApplyGuardrailError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
115 crate::operation::apply_guardrail::ApplyGuardrailError::ThrottlingException(inner) => Error::ThrottlingException(inner),
116 crate::operation::apply_guardrail::ApplyGuardrailError::ValidationException(inner) => Error::ValidationException(inner),
117 crate::operation::apply_guardrail::ApplyGuardrailError::Unhandled(inner) => Error::Unhandled(inner),
118 }
119 }
120}
121impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, 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::converse::ConverseError, 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::converse::ConverseError> for Error {
136 fn from(err: crate::operation::converse::ConverseError) -> Self {
137 match err {
138 crate::operation::converse::ConverseError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
139 crate::operation::converse::ConverseError::InternalServerException(inner) => Error::InternalServerException(inner),
140 crate::operation::converse::ConverseError::ModelErrorException(inner) => Error::ModelErrorException(inner),
141 crate::operation::converse::ConverseError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
142 crate::operation::converse::ConverseError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
143 crate::operation::converse::ConverseError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
144 crate::operation::converse::ConverseError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
145 crate::operation::converse::ConverseError::ThrottlingException(inner) => Error::ThrottlingException(inner),
146 crate::operation::converse::ConverseError::ValidationException(inner) => Error::ValidationException(inner),
147 crate::operation::converse::ConverseError::Unhandled(inner) => Error::Unhandled(inner),
148 }
149 }
150}
151impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>> for Error
152where
153 R: Send + Sync + std::fmt::Debug + 'static,
154{
155 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>) -> Self {
156 match err {
157 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
158 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
159 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
160 source: err.into(),
161 }),
162 }
163 }
164}
165impl From<crate::operation::converse_stream::ConverseStreamError> for Error {
166 fn from(err: crate::operation::converse_stream::ConverseStreamError) -> Self {
167 match err {
168 crate::operation::converse_stream::ConverseStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
169 crate::operation::converse_stream::ConverseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
170 crate::operation::converse_stream::ConverseStreamError::ModelErrorException(inner) => Error::ModelErrorException(inner),
171 crate::operation::converse_stream::ConverseStreamError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
172 crate::operation::converse_stream::ConverseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
173 crate::operation::converse_stream::ConverseStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
174 crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
175 crate::operation::converse_stream::ConverseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
176 crate::operation::converse_stream::ConverseStreamError::ValidationException(inner) => Error::ValidationException(inner),
177 crate::operation::converse_stream::ConverseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
178 crate::operation::converse_stream::ConverseStreamError::Unhandled(inner) => Error::Unhandled(inner),
179 }
180 }
181}
182impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::count_tokens::CountTokensError, R>> for Error
183where
184 R: Send + Sync + std::fmt::Debug + 'static,
185{
186 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::count_tokens::CountTokensError, R>) -> Self {
187 match err {
188 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
189 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
190 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
191 source: err.into(),
192 }),
193 }
194 }
195}
196impl From<crate::operation::count_tokens::CountTokensError> for Error {
197 fn from(err: crate::operation::count_tokens::CountTokensError) -> Self {
198 match err {
199 crate::operation::count_tokens::CountTokensError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
200 crate::operation::count_tokens::CountTokensError::InternalServerException(inner) => Error::InternalServerException(inner),
201 crate::operation::count_tokens::CountTokensError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
202 crate::operation::count_tokens::CountTokensError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
203 crate::operation::count_tokens::CountTokensError::ThrottlingException(inner) => Error::ThrottlingException(inner),
204 crate::operation::count_tokens::CountTokensError::ValidationException(inner) => Error::ValidationException(inner),
205 crate::operation::count_tokens::CountTokensError::Unhandled(inner) => Error::Unhandled(inner),
206 }
207 }
208}
209impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>> for Error
210where
211 R: Send + Sync + std::fmt::Debug + 'static,
212{
213 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>) -> Self {
214 match err {
215 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
216 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
217 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
218 source: err.into(),
219 }),
220 }
221 }
222}
223impl From<crate::operation::get_async_invoke::GetAsyncInvokeError> for Error {
224 fn from(err: crate::operation::get_async_invoke::GetAsyncInvokeError) -> Self {
225 match err {
226 crate::operation::get_async_invoke::GetAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
227 crate::operation::get_async_invoke::GetAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
228 crate::operation::get_async_invoke::GetAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
229 crate::operation::get_async_invoke::GetAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
230 crate::operation::get_async_invoke::GetAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
231 }
232 }
233}
234impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>> for Error
235where
236 R: Send + Sync + std::fmt::Debug + 'static,
237{
238 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>) -> Self {
239 match err {
240 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
241 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
242 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
243 source: err.into(),
244 }),
245 }
246 }
247}
248impl From<crate::operation::invoke_model::InvokeModelError> for Error {
249 fn from(err: crate::operation::invoke_model::InvokeModelError) -> Self {
250 match err {
251 crate::operation::invoke_model::InvokeModelError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
252 crate::operation::invoke_model::InvokeModelError::InternalServerException(inner) => Error::InternalServerException(inner),
253 crate::operation::invoke_model::InvokeModelError::ModelErrorException(inner) => Error::ModelErrorException(inner),
254 crate::operation::invoke_model::InvokeModelError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
255 crate::operation::invoke_model::InvokeModelError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
256 crate::operation::invoke_model::InvokeModelError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
257 crate::operation::invoke_model::InvokeModelError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
258 crate::operation::invoke_model::InvokeModelError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
259 crate::operation::invoke_model::InvokeModelError::ThrottlingException(inner) => Error::ThrottlingException(inner),
260 crate::operation::invoke_model::InvokeModelError::ValidationException(inner) => Error::ValidationException(inner),
261 crate::operation::invoke_model::InvokeModelError::Unhandled(inner) => Error::Unhandled(inner),
262 }
263 }
264}
265impl<R>
266 From<
267 ::aws_smithy_runtime_api::client::result::SdkError<
268 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
269 R,
270 >,
271 > for Error
272where
273 R: Send + Sync + std::fmt::Debug + 'static,
274{
275 fn from(
276 err: ::aws_smithy_runtime_api::client::result::SdkError<
277 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
278 R,
279 >,
280 ) -> Self {
281 match err {
282 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
283 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
284 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
285 source: err.into(),
286 }),
287 }
288 }
289}
290impl From<crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError> for Error {
291 fn from(err: crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError) -> Self {
292 match err {
293 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::AccessDeniedException(inner) => {
294 Error::AccessDeniedException(inner)
295 }
296 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::InternalServerException(inner) => {
297 Error::InternalServerException(inner)
298 }
299 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelErrorException(inner) => {
300 Error::ModelErrorException(inner)
301 }
302 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelNotReadyException(inner) => {
303 Error::ModelNotReadyException(inner)
304 }
305 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelStreamErrorException(inner) => {
306 Error::ModelStreamErrorException(inner)
307 }
308 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelTimeoutException(inner) => {
309 Error::ModelTimeoutException(inner)
310 }
311 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ResourceNotFoundException(inner) => {
312 Error::ResourceNotFoundException(inner)
313 }
314 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceQuotaExceededException(
315 inner,
316 ) => Error::ServiceQuotaExceededException(inner),
317 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceUnavailableException(inner) => {
318 Error::ServiceUnavailableException(inner)
319 }
320 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ThrottlingException(inner) => {
321 Error::ThrottlingException(inner)
322 }
323 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ValidationException(inner) => {
324 Error::ValidationException(inner)
325 }
326 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::Unhandled(inner) => {
327 Error::Unhandled(inner)
328 }
329 }
330 }
331}
332impl<R>
333 From<
334 ::aws_smithy_runtime_api::client::result::SdkError<
335 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
336 R,
337 >,
338 > for Error
339where
340 R: Send + Sync + std::fmt::Debug + 'static,
341{
342 fn from(
343 err: ::aws_smithy_runtime_api::client::result::SdkError<
344 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
345 R,
346 >,
347 ) -> Self {
348 match err {
349 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
350 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
351 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
352 source: err.into(),
353 }),
354 }
355 }
356}
357impl From<crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError> for Error {
358 fn from(err: crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError) -> Self {
359 match err {
360 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::AccessDeniedException(inner) => {
361 Error::AccessDeniedException(inner)
362 }
363 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::InternalServerException(inner) => {
364 Error::InternalServerException(inner)
365 }
366 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelErrorException(inner) => {
367 Error::ModelErrorException(inner)
368 }
369 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelNotReadyException(inner) => {
370 Error::ModelNotReadyException(inner)
371 }
372 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelStreamErrorException(inner) => {
373 Error::ModelStreamErrorException(inner)
374 }
375 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelTimeoutException(inner) => {
376 Error::ModelTimeoutException(inner)
377 }
378 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ResourceNotFoundException(inner) => {
379 Error::ResourceNotFoundException(inner)
380 }
381 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceQuotaExceededException(inner) => {
382 Error::ServiceQuotaExceededException(inner)
383 }
384 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceUnavailableException(inner) => {
385 Error::ServiceUnavailableException(inner)
386 }
387 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ThrottlingException(inner) => {
388 Error::ThrottlingException(inner)
389 }
390 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ValidationException(inner) => {
391 Error::ValidationException(inner)
392 }
393 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
394 }
395 }
396}
397impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>> for Error
398where
399 R: Send + Sync + std::fmt::Debug + 'static,
400{
401 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>) -> Self {
402 match err {
403 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
404 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
405 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
406 source: err.into(),
407 }),
408 }
409 }
410}
411impl From<crate::operation::list_async_invokes::ListAsyncInvokesError> for Error {
412 fn from(err: crate::operation::list_async_invokes::ListAsyncInvokesError) -> Self {
413 match err {
414 crate::operation::list_async_invokes::ListAsyncInvokesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
415 crate::operation::list_async_invokes::ListAsyncInvokesError::InternalServerException(inner) => Error::InternalServerException(inner),
416 crate::operation::list_async_invokes::ListAsyncInvokesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
417 crate::operation::list_async_invokes::ListAsyncInvokesError::ValidationException(inner) => Error::ValidationException(inner),
418 crate::operation::list_async_invokes::ListAsyncInvokesError::Unhandled(inner) => Error::Unhandled(inner),
419 }
420 }
421}
422impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>> for Error
423where
424 R: Send + Sync + std::fmt::Debug + 'static,
425{
426 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>) -> Self {
427 match err {
428 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
429 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
430 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
431 source: err.into(),
432 }),
433 }
434 }
435}
436impl From<crate::operation::start_async_invoke::StartAsyncInvokeError> for Error {
437 fn from(err: crate::operation::start_async_invoke::StartAsyncInvokeError) -> Self {
438 match err {
439 crate::operation::start_async_invoke::StartAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
440 crate::operation::start_async_invoke::StartAsyncInvokeError::ConflictException(inner) => Error::ConflictException(inner),
441 crate::operation::start_async_invoke::StartAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
442 crate::operation::start_async_invoke::StartAsyncInvokeError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
443 crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceQuotaExceededException(inner) => {
444 Error::ServiceQuotaExceededException(inner)
445 }
446 crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceUnavailableException(inner) => {
447 Error::ServiceUnavailableException(inner)
448 }
449 crate::operation::start_async_invoke::StartAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
450 crate::operation::start_async_invoke::StartAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
451 crate::operation::start_async_invoke::StartAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
452 }
453 }
454}
455impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>> for Error
456where
457 R: Send + Sync + std::fmt::Debug + 'static,
458{
459 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>) -> Self {
460 match err {
461 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
462 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
463 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
464 source: err.into(),
465 }),
466 }
467 }
468}
469impl From<crate::types::error::ConverseStreamOutputError> for Error {
470 fn from(err: crate::types::error::ConverseStreamOutputError) -> Self {
471 match err {
472 crate::types::error::ConverseStreamOutputError::InternalServerException(inner) => Error::InternalServerException(inner),
473 crate::types::error::ConverseStreamOutputError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
474 crate::types::error::ConverseStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
475 crate::types::error::ConverseStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
476 crate::types::error::ConverseStreamOutputError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
477 crate::types::error::ConverseStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
478 }
479 }
480}
481impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>> for Error
482where
483 R: Send + Sync + std::fmt::Debug + 'static,
484{
485 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>) -> Self {
486 match err {
487 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
488 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
489 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
490 source: err.into(),
491 }),
492 }
493 }
494}
495impl From<crate::types::error::InvokeModelWithBidirectionalStreamInputError> for Error {
496 fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamInputError) -> Self {
497 match err {
498 crate::types::error::InvokeModelWithBidirectionalStreamInputError::Unhandled(inner) => Error::Unhandled(inner),
499 }
500 }
501}
502impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>> for Error
503where
504 R: Send + Sync + std::fmt::Debug + 'static,
505{
506 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>) -> Self {
507 match err {
508 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
509 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
510 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
511 source: err.into(),
512 }),
513 }
514 }
515}
516impl From<crate::types::error::InvokeModelWithBidirectionalStreamOutputError> for Error {
517 fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamOutputError) -> Self {
518 match err {
519 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::InternalServerException(inner) => {
520 Error::InternalServerException(inner)
521 }
522 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelStreamErrorException(inner) => {
523 Error::ModelStreamErrorException(inner)
524 }
525 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
526 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
527 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
528 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ServiceUnavailableException(inner) => {
529 Error::ServiceUnavailableException(inner)
530 }
531 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
532 }
533 }
534}
535impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>> for Error
536where
537 R: Send + Sync + std::fmt::Debug + 'static,
538{
539 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>) -> Self {
540 match err {
541 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
542 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
543 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
544 source: err.into(),
545 }),
546 }
547 }
548}
549impl From<crate::types::error::ResponseStreamError> for Error {
550 fn from(err: crate::types::error::ResponseStreamError) -> Self {
551 match err {
552 crate::types::error::ResponseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
553 crate::types::error::ResponseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
554 crate::types::error::ResponseStreamError::ValidationException(inner) => Error::ValidationException(inner),
555 crate::types::error::ResponseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
556 crate::types::error::ResponseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
557 crate::types::error::ResponseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
558 crate::types::error::ResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
559 }
560 }
561}
562impl ::std::error::Error for Error {
563 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
564 match self {
565 Error::AccessDeniedException(inner) => inner.source(),
566 Error::ConflictException(inner) => inner.source(),
567 Error::InternalServerException(inner) => inner.source(),
568 Error::ModelErrorException(inner) => inner.source(),
569 Error::ModelNotReadyException(inner) => inner.source(),
570 Error::ModelStreamErrorException(inner) => inner.source(),
571 Error::ModelTimeoutException(inner) => inner.source(),
572 Error::ResourceNotFoundException(inner) => inner.source(),
573 Error::ServiceQuotaExceededException(inner) => inner.source(),
574 Error::ServiceUnavailableException(inner) => inner.source(),
575 Error::ThrottlingException(inner) => inner.source(),
576 Error::ValidationException(inner) => inner.source(),
577 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
578 }
579 }
580}
581impl ::aws_types::request_id::RequestId for Error {
582 fn request_id(&self) -> Option<&str> {
583 match self {
584 Self::AccessDeniedException(e) => e.request_id(),
585 Self::ConflictException(e) => e.request_id(),
586 Self::InternalServerException(e) => e.request_id(),
587 Self::ModelErrorException(e) => e.request_id(),
588 Self::ModelNotReadyException(e) => e.request_id(),
589 Self::ModelStreamErrorException(e) => e.request_id(),
590 Self::ModelTimeoutException(e) => e.request_id(),
591 Self::ResourceNotFoundException(e) => e.request_id(),
592 Self::ServiceQuotaExceededException(e) => e.request_id(),
593 Self::ServiceUnavailableException(e) => e.request_id(),
594 Self::ThrottlingException(e) => e.request_id(),
595 Self::ValidationException(e) => e.request_id(),
596 Self::Unhandled(e) => e.meta.request_id(),
597 }
598 }
599}