1#[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::create_dashboard::CreateDashboardError, R>> for Error
68where
69 R: Send + Sync + std::fmt::Debug + 'static,
70{
71 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_dashboard::CreateDashboardError, R>) -> Self {
72 match err {
73 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
74 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
75 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
76 source: err.into(),
77 }),
78 }
79 }
80}
81impl From<crate::operation::create_dashboard::CreateDashboardError> for Error {
82 fn from(err: crate::operation::create_dashboard::CreateDashboardError) -> Self {
83 match err {
84 crate::operation::create_dashboard::CreateDashboardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
85 crate::operation::create_dashboard::CreateDashboardError::InternalServerException(inner) => Error::InternalServerException(inner),
86 crate::operation::create_dashboard::CreateDashboardError::ServiceQuotaExceededException(inner) => {
87 Error::ServiceQuotaExceededException(inner)
88 }
89 crate::operation::create_dashboard::CreateDashboardError::ThrottlingException(inner) => Error::ThrottlingException(inner),
90 crate::operation::create_dashboard::CreateDashboardError::ValidationException(inner) => Error::ValidationException(inner),
91 crate::operation::create_dashboard::CreateDashboardError::Unhandled(inner) => Error::Unhandled(inner),
92 }
93 }
94}
95impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_dashboard::DeleteDashboardError, R>> for Error
96where
97 R: Send + Sync + std::fmt::Debug + 'static,
98{
99 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_dashboard::DeleteDashboardError, R>) -> Self {
100 match err {
101 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
102 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
103 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
104 source: err.into(),
105 }),
106 }
107 }
108}
109impl From<crate::operation::delete_dashboard::DeleteDashboardError> for Error {
110 fn from(err: crate::operation::delete_dashboard::DeleteDashboardError) -> Self {
111 match err {
112 crate::operation::delete_dashboard::DeleteDashboardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
113 crate::operation::delete_dashboard::DeleteDashboardError::InternalServerException(inner) => Error::InternalServerException(inner),
114 crate::operation::delete_dashboard::DeleteDashboardError::ThrottlingException(inner) => Error::ThrottlingException(inner),
115 crate::operation::delete_dashboard::DeleteDashboardError::ValidationException(inner) => Error::ValidationException(inner),
116 crate::operation::delete_dashboard::DeleteDashboardError::Unhandled(inner) => Error::Unhandled(inner),
117 }
118 }
119}
120impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_dashboard::GetDashboardError, 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::get_dashboard::GetDashboardError, 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::get_dashboard::GetDashboardError> for Error {
135 fn from(err: crate::operation::get_dashboard::GetDashboardError) -> Self {
136 match err {
137 crate::operation::get_dashboard::GetDashboardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
138 crate::operation::get_dashboard::GetDashboardError::InternalServerException(inner) => Error::InternalServerException(inner),
139 crate::operation::get_dashboard::GetDashboardError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
140 crate::operation::get_dashboard::GetDashboardError::ThrottlingException(inner) => Error::ThrottlingException(inner),
141 crate::operation::get_dashboard::GetDashboardError::ValidationException(inner) => Error::ValidationException(inner),
142 crate::operation::get_dashboard::GetDashboardError::Unhandled(inner) => Error::Unhandled(inner),
143 }
144 }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_policy::GetResourcePolicyError, R>> for Error
147where
148 R: Send + Sync + std::fmt::Debug + 'static,
149{
150 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_policy::GetResourcePolicyError, R>) -> Self {
151 match err {
152 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
154 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
155 source: err.into(),
156 }),
157 }
158 }
159}
160impl From<crate::operation::get_resource_policy::GetResourcePolicyError> for Error {
161 fn from(err: crate::operation::get_resource_policy::GetResourcePolicyError) -> Self {
162 match err {
163 crate::operation::get_resource_policy::GetResourcePolicyError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
164 crate::operation::get_resource_policy::GetResourcePolicyError::InternalServerException(inner) => Error::InternalServerException(inner),
165 crate::operation::get_resource_policy::GetResourcePolicyError::ResourceNotFoundException(inner) => {
166 Error::ResourceNotFoundException(inner)
167 }
168 crate::operation::get_resource_policy::GetResourcePolicyError::ThrottlingException(inner) => Error::ThrottlingException(inner),
169 crate::operation::get_resource_policy::GetResourcePolicyError::ValidationException(inner) => Error::ValidationException(inner),
170 crate::operation::get_resource_policy::GetResourcePolicyError::Unhandled(inner) => Error::Unhandled(inner),
171 }
172 }
173}
174impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_dashboards::ListDashboardsError, R>> for Error
175where
176 R: Send + Sync + std::fmt::Debug + 'static,
177{
178 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_dashboards::ListDashboardsError, R>) -> Self {
179 match err {
180 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
181 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
182 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
183 source: err.into(),
184 }),
185 }
186 }
187}
188impl From<crate::operation::list_dashboards::ListDashboardsError> for Error {
189 fn from(err: crate::operation::list_dashboards::ListDashboardsError) -> Self {
190 match err {
191 crate::operation::list_dashboards::ListDashboardsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
192 crate::operation::list_dashboards::ListDashboardsError::InternalServerException(inner) => Error::InternalServerException(inner),
193 crate::operation::list_dashboards::ListDashboardsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
194 crate::operation::list_dashboards::ListDashboardsError::ValidationException(inner) => Error::ValidationException(inner),
195 crate::operation::list_dashboards::ListDashboardsError::Unhandled(inner) => Error::Unhandled(inner),
196 }
197 }
198}
199impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
200where
201 R: Send + Sync + std::fmt::Debug + 'static,
202{
203 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
204 match err {
205 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
206 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
207 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
208 source: err.into(),
209 }),
210 }
211 }
212}
213impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
214 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
215 match err {
216 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
217 Error::InternalServerException(inner)
218 }
219 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
220 Error::ResourceNotFoundException(inner)
221 }
222 crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
223 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
224 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
225 }
226 }
227}
228impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
229where
230 R: Send + Sync + std::fmt::Debug + 'static,
231{
232 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
233 match err {
234 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
235 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
236 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
237 source: err.into(),
238 }),
239 }
240 }
241}
242impl From<crate::operation::tag_resource::TagResourceError> for Error {
243 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
244 match err {
245 crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
246 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
247 crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
248 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
249 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
250 }
251 }
252}
253impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
254where
255 R: Send + Sync + std::fmt::Debug + 'static,
256{
257 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
258 match err {
259 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
260 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
261 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
262 source: err.into(),
263 }),
264 }
265 }
266}
267impl From<crate::operation::untag_resource::UntagResourceError> for Error {
268 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
269 match err {
270 crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
271 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
272 crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
273 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
274 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
275 }
276 }
277}
278impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_dashboard::UpdateDashboardError, R>> for Error
279where
280 R: Send + Sync + std::fmt::Debug + 'static,
281{
282 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_dashboard::UpdateDashboardError, R>) -> Self {
283 match err {
284 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
285 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
286 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
287 source: err.into(),
288 }),
289 }
290 }
291}
292impl From<crate::operation::update_dashboard::UpdateDashboardError> for Error {
293 fn from(err: crate::operation::update_dashboard::UpdateDashboardError) -> Self {
294 match err {
295 crate::operation::update_dashboard::UpdateDashboardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
296 crate::operation::update_dashboard::UpdateDashboardError::InternalServerException(inner) => Error::InternalServerException(inner),
297 crate::operation::update_dashboard::UpdateDashboardError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
298 crate::operation::update_dashboard::UpdateDashboardError::ThrottlingException(inner) => Error::ThrottlingException(inner),
299 crate::operation::update_dashboard::UpdateDashboardError::ValidationException(inner) => Error::ValidationException(inner),
300 crate::operation::update_dashboard::UpdateDashboardError::Unhandled(inner) => Error::Unhandled(inner),
301 }
302 }
303}
304impl ::std::error::Error for Error {
305 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
306 match self {
307 Error::AccessDeniedException(inner) => inner.source(),
308 Error::InternalServerException(inner) => inner.source(),
309 Error::ResourceNotFoundException(inner) => inner.source(),
310 Error::ServiceQuotaExceededException(inner) => inner.source(),
311 Error::ThrottlingException(inner) => inner.source(),
312 Error::ValidationException(inner) => inner.source(),
313 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
314 }
315 }
316}
317impl ::aws_types::request_id::RequestId for Error {
318 fn request_id(&self) -> Option<&str> {
319 match self {
320 Self::AccessDeniedException(e) => e.request_id(),
321 Self::InternalServerException(e) => e.request_id(),
322 Self::ResourceNotFoundException(e) => e.request_id(),
323 Self::ServiceQuotaExceededException(e) => e.request_id(),
324 Self::ThrottlingException(e) => e.request_id(),
325 Self::ValidationException(e) => e.request_id(),
326 Self::Unhandled(e) => e.meta.request_id(),
327 }
328 }
329}