aws_sdk_bedrockdataautomationruntime/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 InternalServerException(crate::types::error::InternalServerException),
10 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
14 ThrottlingException(crate::types::error::ThrottlingException),
16 ValidationException(crate::types::error::ValidationException),
18 #[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<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
146where
147 R: Send + Sync + std::fmt::Debug + 'static,
148{
149 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
150 match err {
151 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
152 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
153 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
154 source: err.into(),
155 }),
156 }
157 }
158}
159impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
160 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
161 match err {
162 crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
163 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
164 Error::InternalServerException(inner)
165 }
166 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
167 Error::ResourceNotFoundException(inner)
168 }
169 crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
170 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
171 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
172 }
173 }
174}
175impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
176where
177 R: Send + Sync + std::fmt::Debug + 'static,
178{
179 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
180 match err {
181 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
182 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
183 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
184 source: err.into(),
185 }),
186 }
187 }
188}
189impl From<crate::operation::tag_resource::TagResourceError> for Error {
190 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
191 match err {
192 crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
193 crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
194 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
195 crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
196 crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
197 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
198 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
199 }
200 }
201}
202impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
203where
204 R: Send + Sync + std::fmt::Debug + 'static,
205{
206 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
207 match err {
208 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
209 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
210 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
211 source: err.into(),
212 }),
213 }
214 }
215}
216impl From<crate::operation::untag_resource::UntagResourceError> for Error {
217 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
218 match err {
219 crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
220 crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
221 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
222 crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
223 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
224 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
225 }
226 }
227}
228impl ::std::error::Error for Error {
229 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
230 match self {
231 Error::AccessDeniedException(inner) => inner.source(),
232 Error::InternalServerException(inner) => inner.source(),
233 Error::ResourceNotFoundException(inner) => inner.source(),
234 Error::ServiceQuotaExceededException(inner) => inner.source(),
235 Error::ThrottlingException(inner) => inner.source(),
236 Error::ValidationException(inner) => inner.source(),
237 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
238 }
239 }
240}
241impl ::aws_types::request_id::RequestId for Error {
242 fn request_id(&self) -> Option<&str> {
243 match self {
244 Self::AccessDeniedException(e) => e.request_id(),
245 Self::InternalServerException(e) => e.request_id(),
246 Self::ResourceNotFoundException(e) => e.request_id(),
247 Self::ServiceQuotaExceededException(e) => e.request_id(),
248 Self::ThrottlingException(e) => e.request_id(),
249 Self::ValidationException(e) => e.request_id(),
250 Self::Unhandled(e) => e.meta.request_id(),
251 }
252 }
253}