1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccountActionRequiredException(crate::types::error::AccountActionRequiredException),
8 BadRequestException(crate::types::error::BadRequestException),
10 InternalFailureException(crate::types::error::InternalFailureException),
12 LimitExceededException(crate::types::error::LimitExceededException),
14 NotFoundException(crate::types::error::NotFoundException),
16 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
18 TooManyRequestsException(crate::types::error::TooManyRequestsException),
20 UnauthorizedException(crate::types::error::UnauthorizedException),
22 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
24 variable wildcard pattern and check `.code()`:
25 \
26 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
27 \
28 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
29 Unhandled(crate::error::sealed_unhandled::Unhandled),
30}
31impl ::std::fmt::Display for Error {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 match self {
34 Error::AccountActionRequiredException(inner) => inner.fmt(f),
35 Error::BadRequestException(inner) => inner.fmt(f),
36 Error::InternalFailureException(inner) => inner.fmt(f),
37 Error::LimitExceededException(inner) => inner.fmt(f),
38 Error::NotFoundException(inner) => inner.fmt(f),
39 Error::ServiceUnavailableException(inner) => inner.fmt(f),
40 Error::TooManyRequestsException(inner) => inner.fmt(f),
41 Error::UnauthorizedException(inner) => inner.fmt(f),
42 Error::Unhandled(_) => {
43 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
44 write!(f, "unhandled error ({code})")
45 } else {
46 f.write_str("unhandled error")
47 }
48 }
49 }
50 }
51}
52impl From<::aws_smithy_types::error::operation::BuildError> for Error {
53 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
54 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
55 source: value.into(),
56 meta: ::std::default::Default::default(),
57 })
58 }
59}
60impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
61 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
62 match self {
63 Self::AccountActionRequiredException(inner) => inner.meta(),
64 Self::BadRequestException(inner) => inner.meta(),
65 Self::InternalFailureException(inner) => inner.meta(),
66 Self::LimitExceededException(inner) => inner.meta(),
67 Self::NotFoundException(inner) => inner.meta(),
68 Self::ServiceUnavailableException(inner) => inner.meta(),
69 Self::TooManyRequestsException(inner) => inner.meta(),
70 Self::UnauthorizedException(inner) => inner.meta(),
71 Self::Unhandled(inner) => &inner.meta,
72 }
73 }
74}
75impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_project::CreateProjectError, R>> for Error
76where
77 R: Send + Sync + std::fmt::Debug + 'static,
78{
79 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_project::CreateProjectError, R>) -> Self {
80 match err {
81 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
82 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
83 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
84 source: err.into(),
85 }),
86 }
87 }
88}
89impl From<crate::operation::create_project::CreateProjectError> for Error {
90 fn from(err: crate::operation::create_project::CreateProjectError) -> Self {
91 match err {
92 crate::operation::create_project::CreateProjectError::BadRequestException(inner) => Error::BadRequestException(inner),
93 crate::operation::create_project::CreateProjectError::InternalFailureException(inner) => Error::InternalFailureException(inner),
94 crate::operation::create_project::CreateProjectError::LimitExceededException(inner) => Error::LimitExceededException(inner),
95 crate::operation::create_project::CreateProjectError::NotFoundException(inner) => Error::NotFoundException(inner),
96 crate::operation::create_project::CreateProjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
97 crate::operation::create_project::CreateProjectError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
98 crate::operation::create_project::CreateProjectError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
99 crate::operation::create_project::CreateProjectError::Unhandled(inner) => Error::Unhandled(inner),
100 }
101 }
102}
103impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_project::DeleteProjectError, 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::delete_project::DeleteProjectError, 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::delete_project::DeleteProjectError> for Error {
118 fn from(err: crate::operation::delete_project::DeleteProjectError) -> Self {
119 match err {
120 crate::operation::delete_project::DeleteProjectError::InternalFailureException(inner) => Error::InternalFailureException(inner),
121 crate::operation::delete_project::DeleteProjectError::NotFoundException(inner) => Error::NotFoundException(inner),
122 crate::operation::delete_project::DeleteProjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
123 crate::operation::delete_project::DeleteProjectError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
124 crate::operation::delete_project::DeleteProjectError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
125 crate::operation::delete_project::DeleteProjectError::Unhandled(inner) => Error::Unhandled(inner),
126 }
127 }
128}
129impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_bundle::DescribeBundleError, R>> for Error
130where
131 R: Send + Sync + std::fmt::Debug + 'static,
132{
133 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_bundle::DescribeBundleError, R>) -> Self {
134 match err {
135 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
136 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
137 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
138 source: err.into(),
139 }),
140 }
141 }
142}
143impl From<crate::operation::describe_bundle::DescribeBundleError> for Error {
144 fn from(err: crate::operation::describe_bundle::DescribeBundleError) -> Self {
145 match err {
146 crate::operation::describe_bundle::DescribeBundleError::BadRequestException(inner) => Error::BadRequestException(inner),
147 crate::operation::describe_bundle::DescribeBundleError::InternalFailureException(inner) => Error::InternalFailureException(inner),
148 crate::operation::describe_bundle::DescribeBundleError::NotFoundException(inner) => Error::NotFoundException(inner),
149 crate::operation::describe_bundle::DescribeBundleError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
150 crate::operation::describe_bundle::DescribeBundleError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
151 crate::operation::describe_bundle::DescribeBundleError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
152 crate::operation::describe_bundle::DescribeBundleError::Unhandled(inner) => Error::Unhandled(inner),
153 }
154 }
155}
156impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_project::DescribeProjectError, R>> for Error
157where
158 R: Send + Sync + std::fmt::Debug + 'static,
159{
160 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_project::DescribeProjectError, R>) -> Self {
161 match err {
162 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
163 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
164 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
165 source: err.into(),
166 }),
167 }
168 }
169}
170impl From<crate::operation::describe_project::DescribeProjectError> for Error {
171 fn from(err: crate::operation::describe_project::DescribeProjectError) -> Self {
172 match err {
173 crate::operation::describe_project::DescribeProjectError::BadRequestException(inner) => Error::BadRequestException(inner),
174 crate::operation::describe_project::DescribeProjectError::InternalFailureException(inner) => Error::InternalFailureException(inner),
175 crate::operation::describe_project::DescribeProjectError::NotFoundException(inner) => Error::NotFoundException(inner),
176 crate::operation::describe_project::DescribeProjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
177 crate::operation::describe_project::DescribeProjectError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
178 crate::operation::describe_project::DescribeProjectError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
179 crate::operation::describe_project::DescribeProjectError::Unhandled(inner) => Error::Unhandled(inner),
180 }
181 }
182}
183impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::export_bundle::ExportBundleError, 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::export_bundle::ExportBundleError, 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::export_bundle::ExportBundleError> for Error {
198 fn from(err: crate::operation::export_bundle::ExportBundleError) -> Self {
199 match err {
200 crate::operation::export_bundle::ExportBundleError::BadRequestException(inner) => Error::BadRequestException(inner),
201 crate::operation::export_bundle::ExportBundleError::InternalFailureException(inner) => Error::InternalFailureException(inner),
202 crate::operation::export_bundle::ExportBundleError::NotFoundException(inner) => Error::NotFoundException(inner),
203 crate::operation::export_bundle::ExportBundleError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
204 crate::operation::export_bundle::ExportBundleError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
205 crate::operation::export_bundle::ExportBundleError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
206 crate::operation::export_bundle::ExportBundleError::Unhandled(inner) => Error::Unhandled(inner),
207 }
208 }
209}
210impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::export_project::ExportProjectError, R>> for Error
211where
212 R: Send + Sync + std::fmt::Debug + 'static,
213{
214 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::export_project::ExportProjectError, R>) -> Self {
215 match err {
216 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
217 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
218 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
219 source: err.into(),
220 }),
221 }
222 }
223}
224impl From<crate::operation::export_project::ExportProjectError> for Error {
225 fn from(err: crate::operation::export_project::ExportProjectError) -> Self {
226 match err {
227 crate::operation::export_project::ExportProjectError::BadRequestException(inner) => Error::BadRequestException(inner),
228 crate::operation::export_project::ExportProjectError::InternalFailureException(inner) => Error::InternalFailureException(inner),
229 crate::operation::export_project::ExportProjectError::NotFoundException(inner) => Error::NotFoundException(inner),
230 crate::operation::export_project::ExportProjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
231 crate::operation::export_project::ExportProjectError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
232 crate::operation::export_project::ExportProjectError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
233 crate::operation::export_project::ExportProjectError::Unhandled(inner) => Error::Unhandled(inner),
234 }
235 }
236}
237impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_bundles::ListBundlesError, R>> for Error
238where
239 R: Send + Sync + std::fmt::Debug + 'static,
240{
241 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_bundles::ListBundlesError, R>) -> Self {
242 match err {
243 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
244 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
245 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
246 source: err.into(),
247 }),
248 }
249 }
250}
251impl From<crate::operation::list_bundles::ListBundlesError> for Error {
252 fn from(err: crate::operation::list_bundles::ListBundlesError) -> Self {
253 match err {
254 crate::operation::list_bundles::ListBundlesError::BadRequestException(inner) => Error::BadRequestException(inner),
255 crate::operation::list_bundles::ListBundlesError::InternalFailureException(inner) => Error::InternalFailureException(inner),
256 crate::operation::list_bundles::ListBundlesError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
257 crate::operation::list_bundles::ListBundlesError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
258 crate::operation::list_bundles::ListBundlesError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
259 crate::operation::list_bundles::ListBundlesError::Unhandled(inner) => Error::Unhandled(inner),
260 }
261 }
262}
263impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_projects::ListProjectsError, R>> for Error
264where
265 R: Send + Sync + std::fmt::Debug + 'static,
266{
267 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_projects::ListProjectsError, R>) -> Self {
268 match err {
269 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
270 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
271 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
272 source: err.into(),
273 }),
274 }
275 }
276}
277impl From<crate::operation::list_projects::ListProjectsError> for Error {
278 fn from(err: crate::operation::list_projects::ListProjectsError) -> Self {
279 match err {
280 crate::operation::list_projects::ListProjectsError::BadRequestException(inner) => Error::BadRequestException(inner),
281 crate::operation::list_projects::ListProjectsError::InternalFailureException(inner) => Error::InternalFailureException(inner),
282 crate::operation::list_projects::ListProjectsError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
283 crate::operation::list_projects::ListProjectsError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
284 crate::operation::list_projects::ListProjectsError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
285 crate::operation::list_projects::ListProjectsError::Unhandled(inner) => Error::Unhandled(inner),
286 }
287 }
288}
289impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_project::UpdateProjectError, R>> for Error
290where
291 R: Send + Sync + std::fmt::Debug + 'static,
292{
293 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_project::UpdateProjectError, R>) -> Self {
294 match err {
295 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
296 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
297 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
298 source: err.into(),
299 }),
300 }
301 }
302}
303impl From<crate::operation::update_project::UpdateProjectError> for Error {
304 fn from(err: crate::operation::update_project::UpdateProjectError) -> Self {
305 match err {
306 crate::operation::update_project::UpdateProjectError::AccountActionRequiredException(inner) => {
307 Error::AccountActionRequiredException(inner)
308 }
309 crate::operation::update_project::UpdateProjectError::BadRequestException(inner) => Error::BadRequestException(inner),
310 crate::operation::update_project::UpdateProjectError::InternalFailureException(inner) => Error::InternalFailureException(inner),
311 crate::operation::update_project::UpdateProjectError::LimitExceededException(inner) => Error::LimitExceededException(inner),
312 crate::operation::update_project::UpdateProjectError::NotFoundException(inner) => Error::NotFoundException(inner),
313 crate::operation::update_project::UpdateProjectError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
314 crate::operation::update_project::UpdateProjectError::TooManyRequestsException(inner) => Error::TooManyRequestsException(inner),
315 crate::operation::update_project::UpdateProjectError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
316 crate::operation::update_project::UpdateProjectError::Unhandled(inner) => Error::Unhandled(inner),
317 }
318 }
319}
320impl ::std::error::Error for Error {
321 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
322 match self {
323 Error::AccountActionRequiredException(inner) => inner.source(),
324 Error::BadRequestException(inner) => inner.source(),
325 Error::InternalFailureException(inner) => inner.source(),
326 Error::LimitExceededException(inner) => inner.source(),
327 Error::NotFoundException(inner) => inner.source(),
328 Error::ServiceUnavailableException(inner) => inner.source(),
329 Error::TooManyRequestsException(inner) => inner.source(),
330 Error::UnauthorizedException(inner) => inner.source(),
331 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
332 }
333 }
334}
335impl ::aws_types::request_id::RequestId for Error {
336 fn request_id(&self) -> Option<&str> {
337 match self {
338 Self::AccountActionRequiredException(e) => e.request_id(),
339 Self::BadRequestException(e) => e.request_id(),
340 Self::InternalFailureException(e) => e.request_id(),
341 Self::LimitExceededException(e) => e.request_id(),
342 Self::NotFoundException(e) => e.request_id(),
343 Self::ServiceUnavailableException(e) => e.request_id(),
344 Self::TooManyRequestsException(e) => e.request_id(),
345 Self::UnauthorizedException(e) => e.request_id(),
346 Self::Unhandled(e) => e.meta.request_id(),
347 }
348 }
349}