aws_sdk_bedrockdataautomationruntime/
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    /// This exception will be thrown when customer does not have access to API.
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// This exception is for any internal un-expected service errors.
9    InternalServerException(crate::types::error::InternalServerException),
10    /// This exception will be thrown when resource provided from customer not found.
11    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12    /// This exception will be thrown when service quota is exceeded.
13    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
14    /// This exception will be thrown when customer reached API TPS limit.
15    ThrottlingException(crate::types::error::ThrottlingException),
16    /// This exception will be thrown when customer provided invalid parameters.
17    ValidationException(crate::types::error::ValidationException),
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       `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::AccessDeniedException(inner) => inner.fmt(f),
31            Error::InternalServerException(inner) => inner.fmt(f),
32            Error::ResourceNotFoundException(inner) => inner.fmt(f),
33            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
34            Error::ThrottlingException(inner) => inner.fmt(f),
35            Error::ValidationException(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::AccessDeniedException(inner) => inner.meta(),
58            Self::InternalServerException(inner) => inner.meta(),
59            Self::ResourceNotFoundException(inner) => inner.meta(),
60            Self::ServiceQuotaExceededException(inner) => inner.meta(),
61            Self::ThrottlingException(inner) => inner.meta(),
62            Self::ValidationException(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_data_automation_status::GetDataAutomationStatusError, 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_data_automation_status::GetDataAutomationStatusError, 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_data_automation_status::GetDataAutomationStatusError> for Error {
85    fn from(err: crate::operation::get_data_automation_status::GetDataAutomationStatusError) -> Self {
86        match err {
87            crate::operation::get_data_automation_status::GetDataAutomationStatusError::AccessDeniedException(inner) => {
88                Error::AccessDeniedException(inner)
89            }
90            crate::operation::get_data_automation_status::GetDataAutomationStatusError::InternalServerException(inner) => {
91                Error::InternalServerException(inner)
92            }
93            crate::operation::get_data_automation_status::GetDataAutomationStatusError::ResourceNotFoundException(inner) => {
94                Error::ResourceNotFoundException(inner)
95            }
96            crate::operation::get_data_automation_status::GetDataAutomationStatusError::ThrottlingException(inner) => {
97                Error::ThrottlingException(inner)
98            }
99            crate::operation::get_data_automation_status::GetDataAutomationStatusError::ValidationException(inner) => {
100                Error::ValidationException(inner)
101            }
102            crate::operation::get_data_automation_status::GetDataAutomationStatusError::Unhandled(inner) => Error::Unhandled(inner),
103        }
104    }
105}
106impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError, R>>
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<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError, R>,
113    ) -> Self {
114        match err {
115            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
116            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
117                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
118                source: err.into(),
119            }),
120        }
121    }
122}
123impl From<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError> for Error {
124    fn from(err: crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError) -> Self {
125        match err {
126            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::AccessDeniedException(inner) => {
127                Error::AccessDeniedException(inner)
128            }
129            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::InternalServerException(inner) => {
130                Error::InternalServerException(inner)
131            }
132            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ServiceQuotaExceededException(inner) => {
133                Error::ServiceQuotaExceededException(inner)
134            }
135            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ThrottlingException(inner) => {
136                Error::ThrottlingException(inner)
137            }
138            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ValidationException(inner) => {
139                Error::ValidationException(inner)
140            }
141            crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::Unhandled(inner) => Error::Unhandled(inner),
142        }
143    }
144}
145impl ::std::error::Error for Error {
146    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
147        match self {
148            Error::AccessDeniedException(inner) => inner.source(),
149            Error::InternalServerException(inner) => inner.source(),
150            Error::ResourceNotFoundException(inner) => inner.source(),
151            Error::ServiceQuotaExceededException(inner) => inner.source(),
152            Error::ThrottlingException(inner) => inner.source(),
153            Error::ValidationException(inner) => inner.source(),
154            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
155        }
156    }
157}
158impl ::aws_types::request_id::RequestId for Error {
159    fn request_id(&self) -> Option<&str> {
160        match self {
161            Self::AccessDeniedException(e) => e.request_id(),
162            Self::InternalServerException(e) => e.request_id(),
163            Self::ResourceNotFoundException(e) => e.request_id(),
164            Self::ServiceQuotaExceededException(e) => e.request_id(),
165            Self::ThrottlingException(e) => e.request_id(),
166            Self::ValidationException(e) => e.request_id(),
167            Self::Unhandled(e) => e.meta.request_id(),
168        }
169    }
170}