aws_sdk_invoicing/
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 don't have sufficient access to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The processing request failed because of an unknown error, exception, or failure.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>The resource could not be found.</p>
11    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12    /// <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.</p>
13    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
14    /// <p>The request was denied due to request throttling.</p>
15    ThrottlingException(crate::types::error::ThrottlingException),
16    /// <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
17    ValidationException(crate::types::error::ValidationException),
18    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
19    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20    variable wildcard pattern and check `.code()`:
21     \
22    &nbsp;&nbsp;&nbsp;`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::batch_get_invoice_profile::BatchGetInvoiceProfileError, 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::batch_get_invoice_profile::BatchGetInvoiceProfileError, 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::batch_get_invoice_profile::BatchGetInvoiceProfileError> for Error {
85    fn from(err: crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError) -> Self {
86        match err {
87            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::AccessDeniedException(inner) => {
88                Error::AccessDeniedException(inner)
89            }
90            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::InternalServerException(inner) => {
91                Error::InternalServerException(inner)
92            }
93            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::ResourceNotFoundException(inner) => {
94                Error::ResourceNotFoundException(inner)
95            }
96            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::ThrottlingException(inner) => Error::ThrottlingException(inner),
97            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::ValidationException(inner) => Error::ValidationException(inner),
98            crate::operation::batch_get_invoice_profile::BatchGetInvoiceProfileError::Unhandled(inner) => Error::Unhandled(inner),
99        }
100    }
101}
102impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_invoice_unit::CreateInvoiceUnitError, R>> for Error
103where
104    R: Send + Sync + std::fmt::Debug + 'static,
105{
106    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_invoice_unit::CreateInvoiceUnitError, R>) -> Self {
107        match err {
108            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
109            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
110                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
111                source: err.into(),
112            }),
113        }
114    }
115}
116impl From<crate::operation::create_invoice_unit::CreateInvoiceUnitError> for Error {
117    fn from(err: crate::operation::create_invoice_unit::CreateInvoiceUnitError) -> Self {
118        match err {
119            crate::operation::create_invoice_unit::CreateInvoiceUnitError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
120            crate::operation::create_invoice_unit::CreateInvoiceUnitError::InternalServerException(inner) => Error::InternalServerException(inner),
121            crate::operation::create_invoice_unit::CreateInvoiceUnitError::ThrottlingException(inner) => Error::ThrottlingException(inner),
122            crate::operation::create_invoice_unit::CreateInvoiceUnitError::ValidationException(inner) => Error::ValidationException(inner),
123            crate::operation::create_invoice_unit::CreateInvoiceUnitError::Unhandled(inner) => Error::Unhandled(inner),
124        }
125    }
126}
127impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_invoice_unit::DeleteInvoiceUnitError, R>> for Error
128where
129    R: Send + Sync + std::fmt::Debug + 'static,
130{
131    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_invoice_unit::DeleteInvoiceUnitError, R>) -> Self {
132        match err {
133            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
134            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
135                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
136                source: err.into(),
137            }),
138        }
139    }
140}
141impl From<crate::operation::delete_invoice_unit::DeleteInvoiceUnitError> for Error {
142    fn from(err: crate::operation::delete_invoice_unit::DeleteInvoiceUnitError) -> Self {
143        match err {
144            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
145            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::InternalServerException(inner) => Error::InternalServerException(inner),
146            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::ResourceNotFoundException(inner) => {
147                Error::ResourceNotFoundException(inner)
148            }
149            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::ThrottlingException(inner) => Error::ThrottlingException(inner),
150            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::ValidationException(inner) => Error::ValidationException(inner),
151            crate::operation::delete_invoice_unit::DeleteInvoiceUnitError::Unhandled(inner) => Error::Unhandled(inner),
152        }
153    }
154}
155impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_invoice_unit::GetInvoiceUnitError, R>> for Error
156where
157    R: Send + Sync + std::fmt::Debug + 'static,
158{
159    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_invoice_unit::GetInvoiceUnitError, R>) -> Self {
160        match err {
161            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
162            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
163                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
164                source: err.into(),
165            }),
166        }
167    }
168}
169impl From<crate::operation::get_invoice_unit::GetInvoiceUnitError> for Error {
170    fn from(err: crate::operation::get_invoice_unit::GetInvoiceUnitError) -> Self {
171        match err {
172            crate::operation::get_invoice_unit::GetInvoiceUnitError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
173            crate::operation::get_invoice_unit::GetInvoiceUnitError::InternalServerException(inner) => Error::InternalServerException(inner),
174            crate::operation::get_invoice_unit::GetInvoiceUnitError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
175            crate::operation::get_invoice_unit::GetInvoiceUnitError::ThrottlingException(inner) => Error::ThrottlingException(inner),
176            crate::operation::get_invoice_unit::GetInvoiceUnitError::ValidationException(inner) => Error::ValidationException(inner),
177            crate::operation::get_invoice_unit::GetInvoiceUnitError::Unhandled(inner) => Error::Unhandled(inner),
178        }
179    }
180}
181impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_invoice_summaries::ListInvoiceSummariesError, R>> for Error
182where
183    R: Send + Sync + std::fmt::Debug + 'static,
184{
185    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_invoice_summaries::ListInvoiceSummariesError, R>) -> Self {
186        match err {
187            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
188            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
189                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
190                source: err.into(),
191            }),
192        }
193    }
194}
195impl From<crate::operation::list_invoice_summaries::ListInvoiceSummariesError> for Error {
196    fn from(err: crate::operation::list_invoice_summaries::ListInvoiceSummariesError) -> Self {
197        match err {
198            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
199            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::InternalServerException(inner) => {
200                Error::InternalServerException(inner)
201            }
202            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::ResourceNotFoundException(inner) => {
203                Error::ResourceNotFoundException(inner)
204            }
205            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
206            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::ValidationException(inner) => Error::ValidationException(inner),
207            crate::operation::list_invoice_summaries::ListInvoiceSummariesError::Unhandled(inner) => Error::Unhandled(inner),
208        }
209    }
210}
211impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_invoice_units::ListInvoiceUnitsError, R>> for Error
212where
213    R: Send + Sync + std::fmt::Debug + 'static,
214{
215    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_invoice_units::ListInvoiceUnitsError, R>) -> Self {
216        match err {
217            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
218            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
219                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
220                source: err.into(),
221            }),
222        }
223    }
224}
225impl From<crate::operation::list_invoice_units::ListInvoiceUnitsError> for Error {
226    fn from(err: crate::operation::list_invoice_units::ListInvoiceUnitsError) -> Self {
227        match err {
228            crate::operation::list_invoice_units::ListInvoiceUnitsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
229            crate::operation::list_invoice_units::ListInvoiceUnitsError::InternalServerException(inner) => Error::InternalServerException(inner),
230            crate::operation::list_invoice_units::ListInvoiceUnitsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
231            crate::operation::list_invoice_units::ListInvoiceUnitsError::ValidationException(inner) => Error::ValidationException(inner),
232            crate::operation::list_invoice_units::ListInvoiceUnitsError::Unhandled(inner) => Error::Unhandled(inner),
233        }
234    }
235}
236impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError> for Error {
251    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
252        match err {
253            crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
254            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
255                Error::InternalServerException(inner)
256            }
257            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
258                Error::ResourceNotFoundException(inner)
259            }
260            crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
261            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
262            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
263        }
264    }
265}
266impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
267where
268    R: Send + Sync + std::fmt::Debug + 'static,
269{
270    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
271        match err {
272            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
273            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
274                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
275                source: err.into(),
276            }),
277        }
278    }
279}
280impl From<crate::operation::tag_resource::TagResourceError> for Error {
281    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
282        match err {
283            crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
284            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
285            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
286            crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
287            crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
288            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
289            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
290        }
291    }
292}
293impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
294where
295    R: Send + Sync + std::fmt::Debug + 'static,
296{
297    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
298        match err {
299            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
300            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
301                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
302                source: err.into(),
303            }),
304        }
305    }
306}
307impl From<crate::operation::untag_resource::UntagResourceError> for Error {
308    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
309        match err {
310            crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
311            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
312            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
313            crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
314            crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
315            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
316        }
317    }
318}
319impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_invoice_unit::UpdateInvoiceUnitError, R>> for Error
320where
321    R: Send + Sync + std::fmt::Debug + 'static,
322{
323    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_invoice_unit::UpdateInvoiceUnitError, R>) -> Self {
324        match err {
325            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
326            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
327                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
328                source: err.into(),
329            }),
330        }
331    }
332}
333impl From<crate::operation::update_invoice_unit::UpdateInvoiceUnitError> for Error {
334    fn from(err: crate::operation::update_invoice_unit::UpdateInvoiceUnitError) -> Self {
335        match err {
336            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
337            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::InternalServerException(inner) => Error::InternalServerException(inner),
338            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::ResourceNotFoundException(inner) => {
339                Error::ResourceNotFoundException(inner)
340            }
341            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::ThrottlingException(inner) => Error::ThrottlingException(inner),
342            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::ValidationException(inner) => Error::ValidationException(inner),
343            crate::operation::update_invoice_unit::UpdateInvoiceUnitError::Unhandled(inner) => Error::Unhandled(inner),
344        }
345    }
346}
347impl ::std::error::Error for Error {
348    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
349        match self {
350            Error::AccessDeniedException(inner) => inner.source(),
351            Error::InternalServerException(inner) => inner.source(),
352            Error::ResourceNotFoundException(inner) => inner.source(),
353            Error::ServiceQuotaExceededException(inner) => inner.source(),
354            Error::ThrottlingException(inner) => inner.source(),
355            Error::ValidationException(inner) => inner.source(),
356            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
357        }
358    }
359}
360impl ::aws_types::request_id::RequestId for Error {
361    fn request_id(&self) -> Option<&str> {
362        match self {
363            Self::AccessDeniedException(e) => e.request_id(),
364            Self::InternalServerException(e) => e.request_id(),
365            Self::ResourceNotFoundException(e) => e.request_id(),
366            Self::ServiceQuotaExceededException(e) => e.request_id(),
367            Self::ThrottlingException(e) => e.request_id(),
368            Self::ValidationException(e) => e.request_id(),
369            Self::Unhandled(e) => e.meta.request_id(),
370        }
371    }
372}