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::ThrottlingException(inner) => Error::ThrottlingException(inner),
115 crate::operation::apply_guardrail::ApplyGuardrailError::ValidationException(inner) => Error::ValidationException(inner),
116 crate::operation::apply_guardrail::ApplyGuardrailError::Unhandled(inner) => Error::Unhandled(inner),
117 }
118 }
119}
120impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>> for Error
121where
122 R: Send + Sync + std::fmt::Debug + 'static,
123{
124 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>) -> Self {
125 match err {
126 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
127 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
128 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
129 source: err.into(),
130 }),
131 }
132 }
133}
134impl From<crate::operation::converse::ConverseError> for Error {
135 fn from(err: crate::operation::converse::ConverseError) -> Self {
136 match err {
137 crate::operation::converse::ConverseError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
138 crate::operation::converse::ConverseError::InternalServerException(inner) => Error::InternalServerException(inner),
139 crate::operation::converse::ConverseError::ModelErrorException(inner) => Error::ModelErrorException(inner),
140 crate::operation::converse::ConverseError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
141 crate::operation::converse::ConverseError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
142 crate::operation::converse::ConverseError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
143 crate::operation::converse::ConverseError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
144 crate::operation::converse::ConverseError::ThrottlingException(inner) => Error::ThrottlingException(inner),
145 crate::operation::converse::ConverseError::ValidationException(inner) => Error::ValidationException(inner),
146 crate::operation::converse::ConverseError::Unhandled(inner) => Error::Unhandled(inner),
147 }
148 }
149}
150impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>> for Error
151where
152 R: Send + Sync + std::fmt::Debug + 'static,
153{
154 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>) -> Self {
155 match err {
156 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
157 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
158 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
159 source: err.into(),
160 }),
161 }
162 }
163}
164impl From<crate::operation::converse_stream::ConverseStreamError> for Error {
165 fn from(err: crate::operation::converse_stream::ConverseStreamError) -> Self {
166 match err {
167 crate::operation::converse_stream::ConverseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
168 crate::operation::converse_stream::ConverseStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
169 crate::operation::converse_stream::ConverseStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
170 crate::operation::converse_stream::ConverseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
171 crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
172 crate::operation::converse_stream::ConverseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
173 crate::operation::converse_stream::ConverseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
174 crate::operation::converse_stream::ConverseStreamError::ValidationException(inner) => Error::ValidationException(inner),
175 crate::operation::converse_stream::ConverseStreamError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
176 crate::operation::converse_stream::ConverseStreamError::ModelErrorException(inner) => Error::ModelErrorException(inner),
177 crate::operation::converse_stream::ConverseStreamError::Unhandled(inner) => Error::Unhandled(inner),
178 }
179 }
180}
181impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::count_tokens::CountTokensError, R>> for Error
182where
183 R: Send + Sync + std::fmt::Debug + 'static,
184{
185 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::count_tokens::CountTokensError, R>) -> Self {
186 match err {
187 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
188 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
189 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
190 source: err.into(),
191 }),
192 }
193 }
194}
195impl From<crate::operation::count_tokens::CountTokensError> for Error {
196 fn from(err: crate::operation::count_tokens::CountTokensError) -> Self {
197 match err {
198 crate::operation::count_tokens::CountTokensError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
199 crate::operation::count_tokens::CountTokensError::InternalServerException(inner) => Error::InternalServerException(inner),
200 crate::operation::count_tokens::CountTokensError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
201 crate::operation::count_tokens::CountTokensError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
202 crate::operation::count_tokens::CountTokensError::ThrottlingException(inner) => Error::ThrottlingException(inner),
203 crate::operation::count_tokens::CountTokensError::ValidationException(inner) => Error::ValidationException(inner),
204 crate::operation::count_tokens::CountTokensError::Unhandled(inner) => Error::Unhandled(inner),
205 }
206 }
207}
208impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>> for Error
209where
210 R: Send + Sync + std::fmt::Debug + 'static,
211{
212 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>) -> Self {
213 match err {
214 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
215 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
216 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
217 source: err.into(),
218 }),
219 }
220 }
221}
222impl From<crate::operation::get_async_invoke::GetAsyncInvokeError> for Error {
223 fn from(err: crate::operation::get_async_invoke::GetAsyncInvokeError) -> Self {
224 match err {
225 crate::operation::get_async_invoke::GetAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
226 crate::operation::get_async_invoke::GetAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
227 crate::operation::get_async_invoke::GetAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
228 crate::operation::get_async_invoke::GetAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
229 crate::operation::get_async_invoke::GetAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
230 }
231 }
232}
233impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>> for Error
234where
235 R: Send + Sync + std::fmt::Debug + 'static,
236{
237 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>) -> Self {
238 match err {
239 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
240 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
241 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
242 source: err.into(),
243 }),
244 }
245 }
246}
247impl From<crate::operation::invoke_model::InvokeModelError> for Error {
248 fn from(err: crate::operation::invoke_model::InvokeModelError) -> Self {
249 match err {
250 crate::operation::invoke_model::InvokeModelError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
251 crate::operation::invoke_model::InvokeModelError::InternalServerException(inner) => Error::InternalServerException(inner),
252 crate::operation::invoke_model::InvokeModelError::ModelErrorException(inner) => Error::ModelErrorException(inner),
253 crate::operation::invoke_model::InvokeModelError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
254 crate::operation::invoke_model::InvokeModelError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
255 crate::operation::invoke_model::InvokeModelError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
256 crate::operation::invoke_model::InvokeModelError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
257 crate::operation::invoke_model::InvokeModelError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
258 crate::operation::invoke_model::InvokeModelError::ThrottlingException(inner) => Error::ThrottlingException(inner),
259 crate::operation::invoke_model::InvokeModelError::ValidationException(inner) => Error::ValidationException(inner),
260 crate::operation::invoke_model::InvokeModelError::Unhandled(inner) => Error::Unhandled(inner),
261 }
262 }
263}
264impl<R>
265 From<
266 ::aws_smithy_runtime_api::client::result::SdkError<
267 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
268 R,
269 >,
270 > for Error
271where
272 R: Send + Sync + std::fmt::Debug + 'static,
273{
274 fn from(
275 err: ::aws_smithy_runtime_api::client::result::SdkError<
276 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
277 R,
278 >,
279 ) -> Self {
280 match err {
281 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
282 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
283 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
284 source: err.into(),
285 }),
286 }
287 }
288}
289impl From<crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError> for Error {
290 fn from(err: crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError) -> Self {
291 match err {
292 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelTimeoutException(inner) => {
293 Error::ModelTimeoutException(inner)
294 }
295 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::AccessDeniedException(inner) => {
296 Error::AccessDeniedException(inner)
297 }
298 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ResourceNotFoundException(inner) => {
299 Error::ResourceNotFoundException(inner)
300 }
301 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ThrottlingException(inner) => {
302 Error::ThrottlingException(inner)
303 }
304 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceUnavailableException(inner) => {
305 Error::ServiceUnavailableException(inner)
306 }
307 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::InternalServerException(inner) => {
308 Error::InternalServerException(inner)
309 }
310 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelStreamErrorException(inner) => {
311 Error::ModelStreamErrorException(inner)
312 }
313 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ValidationException(inner) => {
314 Error::ValidationException(inner)
315 }
316 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelNotReadyException(inner) => {
317 Error::ModelNotReadyException(inner)
318 }
319 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelErrorException(inner) => {
320 Error::ModelErrorException(inner)
321 }
322 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceQuotaExceededException(
323 inner,
324 ) => Error::ServiceQuotaExceededException(inner),
325 crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::Unhandled(inner) => {
326 Error::Unhandled(inner)
327 }
328 }
329 }
330}
331impl<R>
332 From<
333 ::aws_smithy_runtime_api::client::result::SdkError<
334 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
335 R,
336 >,
337 > for Error
338where
339 R: Send + Sync + std::fmt::Debug + 'static,
340{
341 fn from(
342 err: ::aws_smithy_runtime_api::client::result::SdkError<
343 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
344 R,
345 >,
346 ) -> Self {
347 match err {
348 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
349 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
350 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
351 source: err.into(),
352 }),
353 }
354 }
355}
356impl From<crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError> for Error {
357 fn from(err: crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError) -> Self {
358 match err {
359 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelTimeoutException(inner) => {
360 Error::ModelTimeoutException(inner)
361 }
362 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::AccessDeniedException(inner) => {
363 Error::AccessDeniedException(inner)
364 }
365 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ResourceNotFoundException(inner) => {
366 Error::ResourceNotFoundException(inner)
367 }
368 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ThrottlingException(inner) => {
369 Error::ThrottlingException(inner)
370 }
371 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceUnavailableException(inner) => {
372 Error::ServiceUnavailableException(inner)
373 }
374 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::InternalServerException(inner) => {
375 Error::InternalServerException(inner)
376 }
377 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelStreamErrorException(inner) => {
378 Error::ModelStreamErrorException(inner)
379 }
380 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ValidationException(inner) => {
381 Error::ValidationException(inner)
382 }
383 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelNotReadyException(inner) => {
384 Error::ModelNotReadyException(inner)
385 }
386 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelErrorException(inner) => {
387 Error::ModelErrorException(inner)
388 }
389 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceQuotaExceededException(inner) => {
390 Error::ServiceQuotaExceededException(inner)
391 }
392 crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
393 }
394 }
395}
396impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>> for Error
397where
398 R: Send + Sync + std::fmt::Debug + 'static,
399{
400 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>) -> Self {
401 match err {
402 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
403 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
404 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
405 source: err.into(),
406 }),
407 }
408 }
409}
410impl From<crate::operation::list_async_invokes::ListAsyncInvokesError> for Error {
411 fn from(err: crate::operation::list_async_invokes::ListAsyncInvokesError) -> Self {
412 match err {
413 crate::operation::list_async_invokes::ListAsyncInvokesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
414 crate::operation::list_async_invokes::ListAsyncInvokesError::InternalServerException(inner) => Error::InternalServerException(inner),
415 crate::operation::list_async_invokes::ListAsyncInvokesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
416 crate::operation::list_async_invokes::ListAsyncInvokesError::ValidationException(inner) => Error::ValidationException(inner),
417 crate::operation::list_async_invokes::ListAsyncInvokesError::Unhandled(inner) => Error::Unhandled(inner),
418 }
419 }
420}
421impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>> for Error
422where
423 R: Send + Sync + std::fmt::Debug + 'static,
424{
425 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>) -> Self {
426 match err {
427 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
428 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
429 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
430 source: err.into(),
431 }),
432 }
433 }
434}
435impl From<crate::operation::start_async_invoke::StartAsyncInvokeError> for Error {
436 fn from(err: crate::operation::start_async_invoke::StartAsyncInvokeError) -> Self {
437 match err {
438 crate::operation::start_async_invoke::StartAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
439 crate::operation::start_async_invoke::StartAsyncInvokeError::ConflictException(inner) => Error::ConflictException(inner),
440 crate::operation::start_async_invoke::StartAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
441 crate::operation::start_async_invoke::StartAsyncInvokeError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
442 crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceQuotaExceededException(inner) => {
443 Error::ServiceQuotaExceededException(inner)
444 }
445 crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceUnavailableException(inner) => {
446 Error::ServiceUnavailableException(inner)
447 }
448 crate::operation::start_async_invoke::StartAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
449 crate::operation::start_async_invoke::StartAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
450 crate::operation::start_async_invoke::StartAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
451 }
452 }
453}
454impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>> for Error
455where
456 R: Send + Sync + std::fmt::Debug + 'static,
457{
458 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>) -> Self {
459 match err {
460 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
461 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
462 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
463 source: err.into(),
464 }),
465 }
466 }
467}
468impl From<crate::types::error::ConverseStreamOutputError> for Error {
469 fn from(err: crate::types::error::ConverseStreamOutputError) -> Self {
470 match err {
471 crate::types::error::ConverseStreamOutputError::InternalServerException(inner) => Error::InternalServerException(inner),
472 crate::types::error::ConverseStreamOutputError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
473 crate::types::error::ConverseStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
474 crate::types::error::ConverseStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
475 crate::types::error::ConverseStreamOutputError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
476 crate::types::error::ConverseStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
477 }
478 }
479}
480impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>> for Error
481where
482 R: Send + Sync + std::fmt::Debug + 'static,
483{
484 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>) -> Self {
485 match err {
486 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
487 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
488 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
489 source: err.into(),
490 }),
491 }
492 }
493}
494impl From<crate::types::error::InvokeModelWithBidirectionalStreamInputError> for Error {
495 fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamInputError) -> Self {
496 match err {
497 crate::types::error::InvokeModelWithBidirectionalStreamInputError::Unhandled(inner) => Error::Unhandled(inner),
498 }
499 }
500}
501impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>> for Error
502where
503 R: Send + Sync + std::fmt::Debug + 'static,
504{
505 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>) -> Self {
506 match err {
507 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
508 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
509 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
510 source: err.into(),
511 }),
512 }
513 }
514}
515impl From<crate::types::error::InvokeModelWithBidirectionalStreamOutputError> for Error {
516 fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamOutputError) -> Self {
517 match err {
518 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::InternalServerException(inner) => {
519 Error::InternalServerException(inner)
520 }
521 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelStreamErrorException(inner) => {
522 Error::ModelStreamErrorException(inner)
523 }
524 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
525 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
526 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
527 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ServiceUnavailableException(inner) => {
528 Error::ServiceUnavailableException(inner)
529 }
530 crate::types::error::InvokeModelWithBidirectionalStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
531 }
532 }
533}
534impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>> for Error
535where
536 R: Send + Sync + std::fmt::Debug + 'static,
537{
538 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>) -> Self {
539 match err {
540 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
541 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
542 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
543 source: err.into(),
544 }),
545 }
546 }
547}
548impl From<crate::types::error::ResponseStreamError> for Error {
549 fn from(err: crate::types::error::ResponseStreamError) -> Self {
550 match err {
551 crate::types::error::ResponseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
552 crate::types::error::ResponseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
553 crate::types::error::ResponseStreamError::ValidationException(inner) => Error::ValidationException(inner),
554 crate::types::error::ResponseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
555 crate::types::error::ResponseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
556 crate::types::error::ResponseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
557 crate::types::error::ResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
558 }
559 }
560}
561impl ::std::error::Error for Error {
562 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
563 match self {
564 Error::AccessDeniedException(inner) => inner.source(),
565 Error::ConflictException(inner) => inner.source(),
566 Error::InternalServerException(inner) => inner.source(),
567 Error::ModelErrorException(inner) => inner.source(),
568 Error::ModelNotReadyException(inner) => inner.source(),
569 Error::ModelStreamErrorException(inner) => inner.source(),
570 Error::ModelTimeoutException(inner) => inner.source(),
571 Error::ResourceNotFoundException(inner) => inner.source(),
572 Error::ServiceQuotaExceededException(inner) => inner.source(),
573 Error::ServiceUnavailableException(inner) => inner.source(),
574 Error::ThrottlingException(inner) => inner.source(),
575 Error::ValidationException(inner) => inner.source(),
576 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
577 }
578 }
579}
580impl ::aws_types::request_id::RequestId for Error {
581 fn request_id(&self) -> Option<&str> {
582 match self {
583 Self::AccessDeniedException(e) => e.request_id(),
584 Self::ConflictException(e) => e.request_id(),
585 Self::InternalServerException(e) => e.request_id(),
586 Self::ModelErrorException(e) => e.request_id(),
587 Self::ModelNotReadyException(e) => e.request_id(),
588 Self::ModelStreamErrorException(e) => e.request_id(),
589 Self::ModelTimeoutException(e) => e.request_id(),
590 Self::ResourceNotFoundException(e) => e.request_id(),
591 Self::ServiceQuotaExceededException(e) => e.request_id(),
592 Self::ServiceUnavailableException(e) => e.request_id(),
593 Self::ThrottlingException(e) => e.request_id(),
594 Self::ValidationException(e) => e.request_id(),
595 Self::Unhandled(e) => e.meta.request_id(),
596 }
597 }
598}