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 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
16 ThrottlingException(crate::types::error::ThrottlingException),
18 ValidationException(crate::types::error::ValidationException),
20 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22 variable wildcard pattern and check `.code()`:
23 \
24 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
25 \
26 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
27 Unhandled(crate::error::sealed_unhandled::Unhandled),
28}
29impl ::std::fmt::Display for Error {
30 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31 match self {
32 Error::AccessDeniedException(inner) => inner.fmt(f),
33 Error::InternalServerException(inner) => inner.fmt(f),
34 Error::ResourceNotFoundException(inner) => inner.fmt(f),
35 Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
36 Error::ServiceUnavailableException(inner) => inner.fmt(f),
37 Error::ThrottlingException(inner) => inner.fmt(f),
38 Error::ValidationException(inner) => inner.fmt(f),
39 Error::Unhandled(_) => {
40 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
41 write!(f, "unhandled error ({code})")
42 } else {
43 f.write_str("unhandled error")
44 }
45 }
46 }
47 }
48}
49impl From<::aws_smithy_types::error::operation::BuildError> for Error {
50 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
51 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
52 source: value.into(),
53 meta: ::std::default::Default::default(),
54 })
55 }
56}
57impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
58 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
59 match self {
60 Self::AccessDeniedException(inner) => inner.meta(),
61 Self::InternalServerException(inner) => inner.meta(),
62 Self::ResourceNotFoundException(inner) => inner.meta(),
63 Self::ServiceQuotaExceededException(inner) => inner.meta(),
64 Self::ServiceUnavailableException(inner) => inner.meta(),
65 Self::ThrottlingException(inner) => inner.meta(),
66 Self::ValidationException(inner) => inner.meta(),
67 Self::Unhandled(inner) => &inner.meta,
68 }
69 }
70}
71impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_data_automation_status::GetDataAutomationStatusError, R>>
72 for Error
73where
74 R: Send + Sync + std::fmt::Debug + 'static,
75{
76 fn from(
77 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_data_automation_status::GetDataAutomationStatusError, R>,
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::get_data_automation_status::GetDataAutomationStatusError> for Error {
89 fn from(err: crate::operation::get_data_automation_status::GetDataAutomationStatusError) -> Self {
90 match err {
91 crate::operation::get_data_automation_status::GetDataAutomationStatusError::AccessDeniedException(inner) => {
92 Error::AccessDeniedException(inner)
93 }
94 crate::operation::get_data_automation_status::GetDataAutomationStatusError::InternalServerException(inner) => {
95 Error::InternalServerException(inner)
96 }
97 crate::operation::get_data_automation_status::GetDataAutomationStatusError::ResourceNotFoundException(inner) => {
98 Error::ResourceNotFoundException(inner)
99 }
100 crate::operation::get_data_automation_status::GetDataAutomationStatusError::ThrottlingException(inner) => {
101 Error::ThrottlingException(inner)
102 }
103 crate::operation::get_data_automation_status::GetDataAutomationStatusError::ValidationException(inner) => {
104 Error::ValidationException(inner)
105 }
106 crate::operation::get_data_automation_status::GetDataAutomationStatusError::Unhandled(inner) => Error::Unhandled(inner),
107 }
108 }
109}
110impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_data_automation::InvokeDataAutomationError, R>> for Error
111where
112 R: Send + Sync + std::fmt::Debug + 'static,
113{
114 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_data_automation::InvokeDataAutomationError, R>) -> Self {
115 match err {
116 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
117 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
118 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
119 source: err.into(),
120 }),
121 }
122 }
123}
124impl From<crate::operation::invoke_data_automation::InvokeDataAutomationError> for Error {
125 fn from(err: crate::operation::invoke_data_automation::InvokeDataAutomationError) -> Self {
126 match err {
127 crate::operation::invoke_data_automation::InvokeDataAutomationError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
128 crate::operation::invoke_data_automation::InvokeDataAutomationError::InternalServerException(inner) => {
129 Error::InternalServerException(inner)
130 }
131 crate::operation::invoke_data_automation::InvokeDataAutomationError::ServiceUnavailableException(inner) => {
132 Error::ServiceUnavailableException(inner)
133 }
134 crate::operation::invoke_data_automation::InvokeDataAutomationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
135 crate::operation::invoke_data_automation::InvokeDataAutomationError::ValidationException(inner) => Error::ValidationException(inner),
136 crate::operation::invoke_data_automation::InvokeDataAutomationError::Unhandled(inner) => Error::Unhandled(inner),
137 }
138 }
139}
140impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError, R>>
141 for Error
142where
143 R: Send + Sync + std::fmt::Debug + 'static,
144{
145 fn from(
146 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError, R>,
147 ) -> Self {
148 match err {
149 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
150 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
151 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
152 source: err.into(),
153 }),
154 }
155 }
156}
157impl From<crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError> for Error {
158 fn from(err: crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError) -> Self {
159 match err {
160 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::AccessDeniedException(inner) => {
161 Error::AccessDeniedException(inner)
162 }
163 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::InternalServerException(inner) => {
164 Error::InternalServerException(inner)
165 }
166 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ServiceQuotaExceededException(inner) => {
167 Error::ServiceQuotaExceededException(inner)
168 }
169 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ThrottlingException(inner) => {
170 Error::ThrottlingException(inner)
171 }
172 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::ValidationException(inner) => {
173 Error::ValidationException(inner)
174 }
175 crate::operation::invoke_data_automation_async::InvokeDataAutomationAsyncError::Unhandled(inner) => Error::Unhandled(inner),
176 }
177 }
178}
179impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
180where
181 R: Send + Sync + std::fmt::Debug + 'static,
182{
183 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
184 match err {
185 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
186 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
187 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
188 source: err.into(),
189 }),
190 }
191 }
192}
193impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
194 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
195 match err {
196 crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
197 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
198 Error::InternalServerException(inner)
199 }
200 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
201 Error::ResourceNotFoundException(inner)
202 }
203 crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
204 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
205 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
206 }
207 }
208}
209impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, 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::tag_resource::TagResourceError, 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::tag_resource::TagResourceError> for Error {
224 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
225 match err {
226 crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
227 crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
228 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
229 crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
230 crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
231 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
232 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
233 }
234 }
235}
236impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
237where
238 R: Send + Sync + std::fmt::Debug + 'static,
239{
240 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
241 match err {
242 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
243 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
244 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
245 source: err.into(),
246 }),
247 }
248 }
249}
250impl From<crate::operation::untag_resource::UntagResourceError> for Error {
251 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
252 match err {
253 crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
254 crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
255 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
256 crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
257 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
258 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
259 }
260 }
261}
262impl ::std::error::Error for Error {
263 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
264 match self {
265 Error::AccessDeniedException(inner) => inner.source(),
266 Error::InternalServerException(inner) => inner.source(),
267 Error::ResourceNotFoundException(inner) => inner.source(),
268 Error::ServiceQuotaExceededException(inner) => inner.source(),
269 Error::ServiceUnavailableException(inner) => inner.source(),
270 Error::ThrottlingException(inner) => inner.source(),
271 Error::ValidationException(inner) => inner.source(),
272 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
273 }
274 }
275}
276impl ::aws_types::request_id::RequestId for Error {
277 fn request_id(&self) -> Option<&str> {
278 match self {
279 Self::AccessDeniedException(e) => e.request_id(),
280 Self::InternalServerException(e) => e.request_id(),
281 Self::ResourceNotFoundException(e) => e.request_id(),
282 Self::ServiceQuotaExceededException(e) => e.request_id(),
283 Self::ServiceUnavailableException(e) => e.request_id(),
284 Self::ThrottlingException(e) => e.request_id(),
285 Self::ValidationException(e) => e.request_id(),
286 Self::Unhandled(e) => e.meta.request_id(),
287 }
288 }
289}