aws_sdk_applicationcostprofiler/
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    /// <p>You do not have permission to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>An internal server error occurred. Retry your request.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>Your request exceeds one or more of the service quotas.</p>
11    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
12    /// <p>The calls to AWS Application Cost Profiler API are throttled. The request was denied.</p>
13    ThrottlingException(crate::types::error::ThrottlingException),
14    /// <p>The input fails to satisfy the constraints for the API.</p>
15    ValidationException(crate::types::error::ValidationException),
16    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
17    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18    variable wildcard pattern and check `.code()`:
19     \
20    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
21     \
22    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
23    Unhandled(crate::error::sealed_unhandled::Unhandled),
24}
25impl ::std::fmt::Display for Error {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Error::AccessDeniedException(inner) => inner.fmt(f),
29            Error::InternalServerException(inner) => inner.fmt(f),
30            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
31            Error::ThrottlingException(inner) => inner.fmt(f),
32            Error::ValidationException(inner) => inner.fmt(f),
33            Error::Unhandled(_) => {
34                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
35                    write!(f, "unhandled error ({code})")
36                } else {
37                    f.write_str("unhandled error")
38                }
39            }
40        }
41    }
42}
43impl From<::aws_smithy_types::error::operation::BuildError> for Error {
44    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
45        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
46            source: value.into(),
47            meta: ::std::default::Default::default(),
48        })
49    }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
52    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
53        match self {
54            Self::AccessDeniedException(inner) => inner.meta(),
55            Self::InternalServerException(inner) => inner.meta(),
56            Self::ServiceQuotaExceededException(inner) => inner.meta(),
57            Self::ThrottlingException(inner) => inner.meta(),
58            Self::ValidationException(inner) => inner.meta(),
59            Self::Unhandled(inner) => &inner.meta,
60        }
61    }
62}
63impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_report_definition::DeleteReportDefinitionError, R>> for Error
64where
65    R: Send + Sync + std::fmt::Debug + 'static,
66{
67    fn from(
68        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_report_definition::DeleteReportDefinitionError, R>,
69    ) -> Self {
70        match err {
71            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
72            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
73                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
74                source: err.into(),
75            }),
76        }
77    }
78}
79impl From<crate::operation::delete_report_definition::DeleteReportDefinitionError> for Error {
80    fn from(err: crate::operation::delete_report_definition::DeleteReportDefinitionError) -> Self {
81        match err {
82            crate::operation::delete_report_definition::DeleteReportDefinitionError::AccessDeniedException(inner) => {
83                Error::AccessDeniedException(inner)
84            }
85            crate::operation::delete_report_definition::DeleteReportDefinitionError::InternalServerException(inner) => {
86                Error::InternalServerException(inner)
87            }
88            crate::operation::delete_report_definition::DeleteReportDefinitionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
89            crate::operation::delete_report_definition::DeleteReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
90            crate::operation::delete_report_definition::DeleteReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
91        }
92    }
93}
94impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report_definition::GetReportDefinitionError, R>> for Error
95where
96    R: Send + Sync + std::fmt::Debug + 'static,
97{
98    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report_definition::GetReportDefinitionError, R>) -> Self {
99        match err {
100            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
101            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
102                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
103                source: err.into(),
104            }),
105        }
106    }
107}
108impl From<crate::operation::get_report_definition::GetReportDefinitionError> for Error {
109    fn from(err: crate::operation::get_report_definition::GetReportDefinitionError) -> Self {
110        match err {
111            crate::operation::get_report_definition::GetReportDefinitionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
112            crate::operation::get_report_definition::GetReportDefinitionError::InternalServerException(inner) => {
113                Error::InternalServerException(inner)
114            }
115            crate::operation::get_report_definition::GetReportDefinitionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
116            crate::operation::get_report_definition::GetReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
117            crate::operation::get_report_definition::GetReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
118        }
119    }
120}
121impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::import_application_usage::ImportApplicationUsageError, R>> for Error
122where
123    R: Send + Sync + std::fmt::Debug + 'static,
124{
125    fn from(
126        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::import_application_usage::ImportApplicationUsageError, R>,
127    ) -> Self {
128        match err {
129            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
130            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
131                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
132                source: err.into(),
133            }),
134        }
135    }
136}
137impl From<crate::operation::import_application_usage::ImportApplicationUsageError> for Error {
138    fn from(err: crate::operation::import_application_usage::ImportApplicationUsageError) -> Self {
139        match err {
140            crate::operation::import_application_usage::ImportApplicationUsageError::AccessDeniedException(inner) => {
141                Error::AccessDeniedException(inner)
142            }
143            crate::operation::import_application_usage::ImportApplicationUsageError::InternalServerException(inner) => {
144                Error::InternalServerException(inner)
145            }
146            crate::operation::import_application_usage::ImportApplicationUsageError::ThrottlingException(inner) => Error::ThrottlingException(inner),
147            crate::operation::import_application_usage::ImportApplicationUsageError::ValidationException(inner) => Error::ValidationException(inner),
148            crate::operation::import_application_usage::ImportApplicationUsageError::Unhandled(inner) => Error::Unhandled(inner),
149        }
150    }
151}
152impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_report_definitions::ListReportDefinitionsError, R>> for Error
153where
154    R: Send + Sync + std::fmt::Debug + 'static,
155{
156    fn from(
157        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_report_definitions::ListReportDefinitionsError, R>,
158    ) -> Self {
159        match err {
160            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
161            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
162                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
163                source: err.into(),
164            }),
165        }
166    }
167}
168impl From<crate::operation::list_report_definitions::ListReportDefinitionsError> for Error {
169    fn from(err: crate::operation::list_report_definitions::ListReportDefinitionsError) -> Self {
170        match err {
171            crate::operation::list_report_definitions::ListReportDefinitionsError::AccessDeniedException(inner) => {
172                Error::AccessDeniedException(inner)
173            }
174            crate::operation::list_report_definitions::ListReportDefinitionsError::InternalServerException(inner) => {
175                Error::InternalServerException(inner)
176            }
177            crate::operation::list_report_definitions::ListReportDefinitionsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
178            crate::operation::list_report_definitions::ListReportDefinitionsError::ValidationException(inner) => Error::ValidationException(inner),
179            crate::operation::list_report_definitions::ListReportDefinitionsError::Unhandled(inner) => Error::Unhandled(inner),
180        }
181    }
182}
183impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_report_definition::PutReportDefinitionError, R>> for Error
184where
185    R: Send + Sync + std::fmt::Debug + 'static,
186{
187    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_report_definition::PutReportDefinitionError, R>) -> Self {
188        match err {
189            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
190            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
191                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
192                source: err.into(),
193            }),
194        }
195    }
196}
197impl From<crate::operation::put_report_definition::PutReportDefinitionError> for Error {
198    fn from(err: crate::operation::put_report_definition::PutReportDefinitionError) -> Self {
199        match err {
200            crate::operation::put_report_definition::PutReportDefinitionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
201            crate::operation::put_report_definition::PutReportDefinitionError::InternalServerException(inner) => {
202                Error::InternalServerException(inner)
203            }
204            crate::operation::put_report_definition::PutReportDefinitionError::ServiceQuotaExceededException(inner) => {
205                Error::ServiceQuotaExceededException(inner)
206            }
207            crate::operation::put_report_definition::PutReportDefinitionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
208            crate::operation::put_report_definition::PutReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
209            crate::operation::put_report_definition::PutReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
210        }
211    }
212}
213impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_report_definition::UpdateReportDefinitionError, R>> for Error
214where
215    R: Send + Sync + std::fmt::Debug + 'static,
216{
217    fn from(
218        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_report_definition::UpdateReportDefinitionError, R>,
219    ) -> Self {
220        match err {
221            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
222            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
223                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
224                source: err.into(),
225            }),
226        }
227    }
228}
229impl From<crate::operation::update_report_definition::UpdateReportDefinitionError> for Error {
230    fn from(err: crate::operation::update_report_definition::UpdateReportDefinitionError) -> Self {
231        match err {
232            crate::operation::update_report_definition::UpdateReportDefinitionError::AccessDeniedException(inner) => {
233                Error::AccessDeniedException(inner)
234            }
235            crate::operation::update_report_definition::UpdateReportDefinitionError::InternalServerException(inner) => {
236                Error::InternalServerException(inner)
237            }
238            crate::operation::update_report_definition::UpdateReportDefinitionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
239            crate::operation::update_report_definition::UpdateReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
240            crate::operation::update_report_definition::UpdateReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
241        }
242    }
243}
244impl ::std::error::Error for Error {
245    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
246        match self {
247            Error::AccessDeniedException(inner) => inner.source(),
248            Error::InternalServerException(inner) => inner.source(),
249            Error::ServiceQuotaExceededException(inner) => inner.source(),
250            Error::ThrottlingException(inner) => inner.source(),
251            Error::ValidationException(inner) => inner.source(),
252            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
253        }
254    }
255}
256impl ::aws_types::request_id::RequestId for Error {
257    fn request_id(&self) -> Option<&str> {
258        match self {
259            Self::AccessDeniedException(e) => e.request_id(),
260            Self::InternalServerException(e) => e.request_id(),
261            Self::ServiceQuotaExceededException(e) => e.request_id(),
262            Self::ThrottlingException(e) => e.request_id(),
263            Self::ValidationException(e) => e.request_id(),
264            Self::Unhandled(e) => e.meta.request_id(),
265        }
266    }
267}