Skip to main content

aws_sdk_marketplacedeployment/
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 sufficient access to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The request configuration has conflicts. For details, see the accompanying error message.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>There was an internal service exception.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The specified resource wasn't found.</p>
13    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14    /// <p>The maximum number of requests per account has been exceeded.</p>
15    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16    /// <p>Too many requests.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// <p>An error occurred during validation.</p>
19    ValidationException(crate::types::error::ValidationException),
20    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
21    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22    variable wildcard pattern and check `.code()`:
23     \
24    &nbsp;&nbsp;&nbsp;`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::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError, 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::list_tags_for_resource::ListTagsForResourceError> for Error {
86    fn from(err: crate::operation::list_tags_for_resource::ListTagsForResourceError) -> Self {
87        match err {
88            crate::operation::list_tags_for_resource::ListTagsForResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89            crate::operation::list_tags_for_resource::ListTagsForResourceError::InternalServerException(inner) => {
90                Error::InternalServerException(inner)
91            }
92            crate::operation::list_tags_for_resource::ListTagsForResourceError::ResourceNotFoundException(inner) => {
93                Error::ResourceNotFoundException(inner)
94            }
95            crate::operation::list_tags_for_resource::ListTagsForResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
96            crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException(inner) => Error::ValidationException(inner),
97            crate::operation::list_tags_for_resource::ListTagsForResourceError::Unhandled(inner) => Error::Unhandled(inner),
98        }
99    }
100}
101impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_deployment_parameter::PutDeploymentParameterError, R>> for Error
102where
103    R: Send + Sync + std::fmt::Debug + 'static,
104{
105    fn from(
106        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_deployment_parameter::PutDeploymentParameterError, R>,
107    ) -> 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::put_deployment_parameter::PutDeploymentParameterError> for Error {
118    fn from(err: crate::operation::put_deployment_parameter::PutDeploymentParameterError) -> Self {
119        match err {
120            crate::operation::put_deployment_parameter::PutDeploymentParameterError::AccessDeniedException(inner) => {
121                Error::AccessDeniedException(inner)
122            }
123            crate::operation::put_deployment_parameter::PutDeploymentParameterError::ConflictException(inner) => Error::ConflictException(inner),
124            crate::operation::put_deployment_parameter::PutDeploymentParameterError::InternalServerException(inner) => {
125                Error::InternalServerException(inner)
126            }
127            crate::operation::put_deployment_parameter::PutDeploymentParameterError::ResourceNotFoundException(inner) => {
128                Error::ResourceNotFoundException(inner)
129            }
130            crate::operation::put_deployment_parameter::PutDeploymentParameterError::ServiceQuotaExceededException(inner) => {
131                Error::ServiceQuotaExceededException(inner)
132            }
133            crate::operation::put_deployment_parameter::PutDeploymentParameterError::ThrottlingException(inner) => Error::ThrottlingException(inner),
134            crate::operation::put_deployment_parameter::PutDeploymentParameterError::ValidationException(inner) => Error::ValidationException(inner),
135            crate::operation::put_deployment_parameter::PutDeploymentParameterError::Unhandled(inner) => Error::Unhandled(inner),
136        }
137    }
138}
139impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>> for Error
140where
141    R: Send + Sync + std::fmt::Debug + 'static,
142{
143    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::tag_resource::TagResourceError, R>) -> Self {
144        match err {
145            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
146            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
147                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
148                source: err.into(),
149            }),
150        }
151    }
152}
153impl From<crate::operation::tag_resource::TagResourceError> for Error {
154    fn from(err: crate::operation::tag_resource::TagResourceError) -> Self {
155        match err {
156            crate::operation::tag_resource::TagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
157            crate::operation::tag_resource::TagResourceError::ConflictException(inner) => Error::ConflictException(inner),
158            crate::operation::tag_resource::TagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
159            crate::operation::tag_resource::TagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
160            crate::operation::tag_resource::TagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
161            crate::operation::tag_resource::TagResourceError::ValidationException(inner) => Error::ValidationException(inner),
162            crate::operation::tag_resource::TagResourceError::Unhandled(inner) => Error::Unhandled(inner),
163        }
164    }
165}
166impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>> for Error
167where
168    R: Send + Sync + std::fmt::Debug + 'static,
169{
170    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::untag_resource::UntagResourceError, R>) -> Self {
171        match err {
172            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
173            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
174                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
175                source: err.into(),
176            }),
177        }
178    }
179}
180impl From<crate::operation::untag_resource::UntagResourceError> for Error {
181    fn from(err: crate::operation::untag_resource::UntagResourceError) -> Self {
182        match err {
183            crate::operation::untag_resource::UntagResourceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
184            crate::operation::untag_resource::UntagResourceError::ConflictException(inner) => Error::ConflictException(inner),
185            crate::operation::untag_resource::UntagResourceError::InternalServerException(inner) => Error::InternalServerException(inner),
186            crate::operation::untag_resource::UntagResourceError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
187            crate::operation::untag_resource::UntagResourceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
188            crate::operation::untag_resource::UntagResourceError::ValidationException(inner) => Error::ValidationException(inner),
189            crate::operation::untag_resource::UntagResourceError::Unhandled(inner) => Error::Unhandled(inner),
190        }
191    }
192}
193impl ::std::error::Error for Error {
194    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
195        match self {
196            Error::AccessDeniedException(inner) => inner.source(),
197            Error::ConflictException(inner) => inner.source(),
198            Error::InternalServerException(inner) => inner.source(),
199            Error::ResourceNotFoundException(inner) => inner.source(),
200            Error::ServiceQuotaExceededException(inner) => inner.source(),
201            Error::ThrottlingException(inner) => inner.source(),
202            Error::ValidationException(inner) => inner.source(),
203            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
204        }
205    }
206}
207impl ::aws_types::request_id::RequestId for Error {
208    fn request_id(&self) -> Option<&str> {
209        match self {
210            Self::AccessDeniedException(e) => e.request_id(),
211            Self::ConflictException(e) => e.request_id(),
212            Self::InternalServerException(e) => e.request_id(),
213            Self::ResourceNotFoundException(e) => e.request_id(),
214            Self::ServiceQuotaExceededException(e) => e.request_id(),
215            Self::ThrottlingException(e) => e.request_id(),
216            Self::ValidationException(e) => e.request_id(),
217            Self::Unhandled(e) => e.meta.request_id(),
218        }
219    }
220}