1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 ConflictException(crate::types::error::ConflictException),
10 InternalServerException(crate::types::error::InternalServerException),
12 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
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::ConflictException(inner) => inner.fmt(f),
34 Error::InternalServerException(inner) => inner.fmt(f),
35 Error::ResourceNotFoundException(inner) => inner.fmt(f),
36 Error::ServiceQuotaExceededException(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::ConflictException(inner) => inner.meta(),
62 Self::InternalServerException(inner) => inner.meta(),
63 Self::ResourceNotFoundException(inner) => inner.meta(),
64 Self::ServiceQuotaExceededException(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_account_settings::GetAccountSettingsError, R>> for Error
72where
73 R: Send + Sync + std::fmt::Debug + 'static,
74{
75 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_settings::GetAccountSettingsError, R>) -> Self {
76 match err {
77 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
78 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
79 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
80 source: err.into(),
81 }),
82 }
83 }
84}
85impl From<crate::operation::get_account_settings::GetAccountSettingsError> for Error {
86 fn from(err: crate::operation::get_account_settings::GetAccountSettingsError) -> Self {
87 match err {
88 crate::operation::get_account_settings::GetAccountSettingsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89 crate::operation::get_account_settings::GetAccountSettingsError::ConflictException(inner) => Error::ConflictException(inner),
90 crate::operation::get_account_settings::GetAccountSettingsError::InternalServerException(inner) => Error::InternalServerException(inner),
91 crate::operation::get_account_settings::GetAccountSettingsError::ResourceNotFoundException(inner) => {
92 Error::ResourceNotFoundException(inner)
93 }
94 crate::operation::get_account_settings::GetAccountSettingsError::ServiceQuotaExceededException(inner) => {
95 Error::ServiceQuotaExceededException(inner)
96 }
97 crate::operation::get_account_settings::GetAccountSettingsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
98 crate::operation::get_account_settings::GetAccountSettingsError::ValidationException(inner) => Error::ValidationException(inner),
99 crate::operation::get_account_settings::GetAccountSettingsError::Unhandled(inner) => Error::Unhandled(inner),
100 }
101 }
102}
103impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report::GetReportError, R>> for Error
104where
105 R: Send + Sync + std::fmt::Debug + 'static,
106{
107 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report::GetReportError, R>) -> Self {
108 match err {
109 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
110 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
111 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
112 source: err.into(),
113 }),
114 }
115 }
116}
117impl From<crate::operation::get_report::GetReportError> for Error {
118 fn from(err: crate::operation::get_report::GetReportError) -> Self {
119 match err {
120 crate::operation::get_report::GetReportError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
121 crate::operation::get_report::GetReportError::ConflictException(inner) => Error::ConflictException(inner),
122 crate::operation::get_report::GetReportError::InternalServerException(inner) => Error::InternalServerException(inner),
123 crate::operation::get_report::GetReportError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
124 crate::operation::get_report::GetReportError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
125 crate::operation::get_report::GetReportError::ThrottlingException(inner) => Error::ThrottlingException(inner),
126 crate::operation::get_report::GetReportError::ValidationException(inner) => Error::ValidationException(inner),
127 crate::operation::get_report::GetReportError::Unhandled(inner) => Error::Unhandled(inner),
128 }
129 }
130}
131impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report_metadata::GetReportMetadataError, R>> for Error
132where
133 R: Send + Sync + std::fmt::Debug + 'static,
134{
135 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_report_metadata::GetReportMetadataError, R>) -> Self {
136 match err {
137 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
138 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
139 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
140 source: err.into(),
141 }),
142 }
143 }
144}
145impl From<crate::operation::get_report_metadata::GetReportMetadataError> for Error {
146 fn from(err: crate::operation::get_report_metadata::GetReportMetadataError) -> Self {
147 match err {
148 crate::operation::get_report_metadata::GetReportMetadataError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
149 crate::operation::get_report_metadata::GetReportMetadataError::InternalServerException(inner) => Error::InternalServerException(inner),
150 crate::operation::get_report_metadata::GetReportMetadataError::ResourceNotFoundException(inner) => {
151 Error::ResourceNotFoundException(inner)
152 }
153 crate::operation::get_report_metadata::GetReportMetadataError::ServiceQuotaExceededException(inner) => {
154 Error::ServiceQuotaExceededException(inner)
155 }
156 crate::operation::get_report_metadata::GetReportMetadataError::ThrottlingException(inner) => Error::ThrottlingException(inner),
157 crate::operation::get_report_metadata::GetReportMetadataError::ValidationException(inner) => Error::ValidationException(inner),
158 crate::operation::get_report_metadata::GetReportMetadataError::Unhandled(inner) => Error::Unhandled(inner),
159 }
160 }
161}
162impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_term_for_report::GetTermForReportError, R>> for Error
163where
164 R: Send + Sync + std::fmt::Debug + 'static,
165{
166 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_term_for_report::GetTermForReportError, R>) -> Self {
167 match err {
168 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
169 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
170 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
171 source: err.into(),
172 }),
173 }
174 }
175}
176impl From<crate::operation::get_term_for_report::GetTermForReportError> for Error {
177 fn from(err: crate::operation::get_term_for_report::GetTermForReportError) -> Self {
178 match err {
179 crate::operation::get_term_for_report::GetTermForReportError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
180 crate::operation::get_term_for_report::GetTermForReportError::ConflictException(inner) => Error::ConflictException(inner),
181 crate::operation::get_term_for_report::GetTermForReportError::InternalServerException(inner) => Error::InternalServerException(inner),
182 crate::operation::get_term_for_report::GetTermForReportError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
183 crate::operation::get_term_for_report::GetTermForReportError::ServiceQuotaExceededException(inner) => {
184 Error::ServiceQuotaExceededException(inner)
185 }
186 crate::operation::get_term_for_report::GetTermForReportError::ThrottlingException(inner) => Error::ThrottlingException(inner),
187 crate::operation::get_term_for_report::GetTermForReportError::ValidationException(inner) => Error::ValidationException(inner),
188 crate::operation::get_term_for_report::GetTermForReportError::Unhandled(inner) => Error::Unhandled(inner),
189 }
190 }
191}
192impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_customer_agreements::ListCustomerAgreementsError, R>> for Error
193where
194 R: Send + Sync + std::fmt::Debug + 'static,
195{
196 fn from(
197 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_customer_agreements::ListCustomerAgreementsError, R>,
198 ) -> Self {
199 match err {
200 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
201 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
202 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
203 source: err.into(),
204 }),
205 }
206 }
207}
208impl From<crate::operation::list_customer_agreements::ListCustomerAgreementsError> for Error {
209 fn from(err: crate::operation::list_customer_agreements::ListCustomerAgreementsError) -> Self {
210 match err {
211 crate::operation::list_customer_agreements::ListCustomerAgreementsError::AccessDeniedException(inner) => {
212 Error::AccessDeniedException(inner)
213 }
214 crate::operation::list_customer_agreements::ListCustomerAgreementsError::InternalServerException(inner) => {
215 Error::InternalServerException(inner)
216 }
217 crate::operation::list_customer_agreements::ListCustomerAgreementsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
218 crate::operation::list_customer_agreements::ListCustomerAgreementsError::ValidationException(inner) => Error::ValidationException(inner),
219 crate::operation::list_customer_agreements::ListCustomerAgreementsError::Unhandled(inner) => Error::Unhandled(inner),
220 }
221 }
222}
223impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_reports::ListReportsError, R>> for Error
224where
225 R: Send + Sync + std::fmt::Debug + 'static,
226{
227 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_reports::ListReportsError, R>) -> Self {
228 match err {
229 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
230 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
231 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
232 source: err.into(),
233 }),
234 }
235 }
236}
237impl From<crate::operation::list_reports::ListReportsError> for Error {
238 fn from(err: crate::operation::list_reports::ListReportsError) -> Self {
239 match err {
240 crate::operation::list_reports::ListReportsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
241 crate::operation::list_reports::ListReportsError::InternalServerException(inner) => Error::InternalServerException(inner),
242 crate::operation::list_reports::ListReportsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
243 crate::operation::list_reports::ListReportsError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
244 crate::operation::list_reports::ListReportsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
245 crate::operation::list_reports::ListReportsError::ValidationException(inner) => Error::ValidationException(inner),
246 crate::operation::list_reports::ListReportsError::Unhandled(inner) => Error::Unhandled(inner),
247 }
248 }
249}
250impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_account_settings::PutAccountSettingsError, R>> for Error
251where
252 R: Send + Sync + std::fmt::Debug + 'static,
253{
254 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_account_settings::PutAccountSettingsError, R>) -> Self {
255 match err {
256 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
257 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
258 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
259 source: err.into(),
260 }),
261 }
262 }
263}
264impl From<crate::operation::put_account_settings::PutAccountSettingsError> for Error {
265 fn from(err: crate::operation::put_account_settings::PutAccountSettingsError) -> Self {
266 match err {
267 crate::operation::put_account_settings::PutAccountSettingsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
268 crate::operation::put_account_settings::PutAccountSettingsError::ConflictException(inner) => Error::ConflictException(inner),
269 crate::operation::put_account_settings::PutAccountSettingsError::InternalServerException(inner) => Error::InternalServerException(inner),
270 crate::operation::put_account_settings::PutAccountSettingsError::ResourceNotFoundException(inner) => {
271 Error::ResourceNotFoundException(inner)
272 }
273 crate::operation::put_account_settings::PutAccountSettingsError::ServiceQuotaExceededException(inner) => {
274 Error::ServiceQuotaExceededException(inner)
275 }
276 crate::operation::put_account_settings::PutAccountSettingsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
277 crate::operation::put_account_settings::PutAccountSettingsError::ValidationException(inner) => Error::ValidationException(inner),
278 crate::operation::put_account_settings::PutAccountSettingsError::Unhandled(inner) => Error::Unhandled(inner),
279 }
280 }
281}
282impl ::std::error::Error for Error {
283 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
284 match self {
285 Error::AccessDeniedException(inner) => inner.source(),
286 Error::ConflictException(inner) => inner.source(),
287 Error::InternalServerException(inner) => inner.source(),
288 Error::ResourceNotFoundException(inner) => inner.source(),
289 Error::ServiceQuotaExceededException(inner) => inner.source(),
290 Error::ThrottlingException(inner) => inner.source(),
291 Error::ValidationException(inner) => inner.source(),
292 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
293 }
294 }
295}
296impl ::aws_types::request_id::RequestId for Error {
297 fn request_id(&self) -> Option<&str> {
298 match self {
299 Self::AccessDeniedException(e) => e.request_id(),
300 Self::ConflictException(e) => e.request_id(),
301 Self::InternalServerException(e) => e.request_id(),
302 Self::ResourceNotFoundException(e) => e.request_id(),
303 Self::ServiceQuotaExceededException(e) => e.request_id(),
304 Self::ThrottlingException(e) => e.request_id(),
305 Self::ValidationException(e) => e.request_id(),
306 Self::Unhandled(e) => e.meta.request_id(),
307 }
308 }
309}