aws_sdk_costandusagereport/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 DuplicateReportNameException(crate::types::error::DuplicateReportNameException),
8 InternalErrorException(crate::types::error::InternalErrorException),
10 ReportLimitReachedException(crate::types::error::ReportLimitReachedException),
12 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14 ValidationException(crate::types::error::ValidationException),
16 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18 variable wildcard pattern and check `.code()`:
19 \
20 `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::DuplicateReportNameException(inner) => inner.fmt(f),
29 Error::InternalErrorException(inner) => inner.fmt(f),
30 Error::ReportLimitReachedException(inner) => inner.fmt(f),
31 Error::ResourceNotFoundException(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::DuplicateReportNameException(inner) => inner.meta(),
55 Self::InternalErrorException(inner) => inner.meta(),
56 Self::ReportLimitReachedException(inner) => inner.meta(),
57 Self::ResourceNotFoundException(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::InternalErrorException(inner) => {
83 Error::InternalErrorException(inner)
84 }
85 crate::operation::delete_report_definition::DeleteReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
86 crate::operation::delete_report_definition::DeleteReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
87 }
88 }
89}
90impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_report_definitions::DescribeReportDefinitionsError, R>>
91 for Error
92where
93 R: Send + Sync + std::fmt::Debug + 'static,
94{
95 fn from(
96 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_report_definitions::DescribeReportDefinitionsError, R>,
97 ) -> Self {
98 match err {
99 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
100 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
101 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
102 source: err.into(),
103 }),
104 }
105 }
106}
107impl From<crate::operation::describe_report_definitions::DescribeReportDefinitionsError> for Error {
108 fn from(err: crate::operation::describe_report_definitions::DescribeReportDefinitionsError) -> Self {
109 match err {
110 crate::operation::describe_report_definitions::DescribeReportDefinitionsError::InternalErrorException(inner) => {
111 Error::InternalErrorException(inner)
112 }
113 crate::operation::describe_report_definitions::DescribeReportDefinitionsError::Unhandled(inner) => Error::Unhandled(inner),
114 }
115 }
116}
117impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>> for Error
118where
119 R: Send + Sync + std::fmt::Debug + 'static,
120{
121 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_tags_for_resource::ListTagsForResourceError, R>) -> Self {
122 match err {
123 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
124 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
125 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
126 source: err.into(),
127 }),
128 }
129 }
130}
131impl From<crate::operation::list_tags_for_resource::ListTagsForResourceError> for Error {
132 fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
133 match err {
134 crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalErrorException(inner) => Error::InternalErrorException(inner),
135 crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
136 Error::ResourceNotFoundException(inner)
137 }
138 crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
139 crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
140 }
141 }
142}
143impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::modify_report_definition::ModifyReportDefinitionError, R>> for Error
144where
145 R: Send + Sync + std::fmt::Debug + 'static,
146{
147 fn from(
148 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::modify_report_definition::ModifyReportDefinitionError, R>,
149 ) -> Self {
150 match err {
151 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
152 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
153 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
154 source: err.into(),
155 }),
156 }
157 }
158}
159impl From<crate::operation::modify_report_definition::ModifyReportDefinitionError> for Error {
160 fn from(err: crate::operation::modify_report_definition::ModifyReportDefinitionError) -> Self {
161 match err {
162 crate::operation::modify_report_definition::ModifyReportDefinitionError::InternalErrorException(inner) => {
163 Error::InternalErrorException(inner)
164 }
165 crate::operation::modify_report_definition::ModifyReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
166 crate::operation::modify_report_definition::ModifyReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
167 }
168 }
169}
170impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_report_definition::PutReportDefinitionError, R>> for Error
171where
172 R: Send + Sync + std::fmt::Debug + 'static,
173{
174 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_report_definition::PutReportDefinitionError, R>) -> Self {
175 match err {
176 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
177 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
178 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
179 source: err.into(),
180 }),
181 }
182 }
183}
184impl From<crate::operation::put_report_definition::PutReportDefinitionError> for Error {
185 fn from(err: crate::operation::put_report_definition::PutReportDefinitionError) -> Self {
186 match err {
187 crate::operation::put_report_definition::PutReportDefinitionError::DuplicateReportNameException(inner) => {
188 Error::DuplicateReportNameException(inner)
189 }
190 crate::operation::put_report_definition::PutReportDefinitionError::InternalErrorException(inner) => Error::InternalErrorException(inner),
191 crate::operation::put_report_definition::PutReportDefinitionError::ReportLimitReachedException(inner) => {
192 Error::ReportLimitReachedException(inner)
193 }
194 crate::operation::put_report_definition::PutReportDefinitionError::ResourceNotFoundException(inner) => {
195 Error::ResourceNotFoundException(inner)
196 }
197 crate::operation::put_report_definition::PutReportDefinitionError::ValidationException(inner) => Error::ValidationException(inner),
198 crate::operation::put_report_definition::PutReportDefinitionError::Unhandled(inner) => Error::Unhandled(inner),
199 }
200 }
201}
202impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
203where
204 R: Send + Sync + std::fmt::Debug + 'static,
205{
206 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
207 match err {
208 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
209 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
210 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
211 source: err.into(),
212 }),
213 }
214 }
215}
216impl From<crate::operation::tag_resource::TagResourceError> for Error {
217 fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
218 match err {
219 crate::operation::tag_resource::TagResourceError::InternalErrorException(inner) => Error::InternalErrorException(inner),
220 crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
221 crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
222 crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
223 }
224 }
225}
226impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
227where
228 R: Send + Sync + std::fmt::Debug + 'static,
229{
230 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
231 match err {
232 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
233 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
234 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
235 source: err.into(),
236 }),
237 }
238 }
239}
240impl From<crate::operation::untag_resource::UntagResourceError> for Error {
241 fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
242 match err {
243 crate::operation::untag_resource::UntagResourceError::InternalErrorException(inner) => Error::InternalErrorException(inner),
244 crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
245 crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
246 crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
247 }
248 }
249}
250impl ::std::error::Error for Error {
251 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
252 match self {
253 Error::DuplicateReportNameException(inner) => inner.source(),
254 Error::InternalErrorException(inner) => inner.source(),
255 Error::ReportLimitReachedException(inner) => inner.source(),
256 Error::ResourceNotFoundException(inner) => inner.source(),
257 Error::ValidationException(inner) => inner.source(),
258 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
259 }
260 }
261}
262impl ::aws_types::request_id::RequestId for Error {
263 fn request_id(&self) -> Option<&str> {
264 match self {
265 Self::DuplicateReportNameException(e) => e.request_id(),
266 Self::InternalErrorException(e) => e.request_id(),
267 Self::ReportLimitReachedException(e) => e.request_id(),
268 Self::ResourceNotFoundException(e) => e.request_id(),
269 Self::ValidationException(e) => e.request_id(),
270 Self::Unhandled(e) => e.meta.request_id(),
271 }
272 }
273}