1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 InternalException(crate::types::error::InternalException),
10 InvalidInputException(crate::types::error::InvalidInputException),
12 LimitExceededException(crate::types::error::LimitExceededException),
14 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16 variable wildcard pattern and check `.code()`:
17 \
18 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
19 \
20 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
21 Unhandled(crate::error::sealed_unhandled::Unhandled),
22}
23impl ::std::fmt::Display for Error {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 Error::AccessDeniedException(inner) => inner.fmt(f),
27 Error::InternalException(inner) => inner.fmt(f),
28 Error::InvalidInputException(inner) => inner.fmt(f),
29 Error::LimitExceededException(inner) => inner.fmt(f),
30 Error::Unhandled(_) => {
31 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
32 write!(f, "unhandled error ({code})")
33 } else {
34 f.write_str("unhandled error")
35 }
36 }
37 }
38 }
39}
40impl From<::aws_smithy_types::error::operation::BuildError> for Error {
41 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
42 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
43 source: value.into(),
44 meta: ::std::default::Default::default(),
45 })
46 }
47}
48impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
49 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
50 match self {
51 Self::AccessDeniedException(inner) => inner.meta(),
52 Self::InternalException(inner) => inner.meta(),
53 Self::InvalidInputException(inner) => inner.meta(),
54 Self::LimitExceededException(inner) => inner.meta(),
55 Self::Unhandled(inner) => &inner.meta,
56 }
57 }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::associate_member_account::AssociateMemberAccountError, R>> for Error
60where
61 R: Send + Sync + std::fmt::Debug + 'static,
62{
63 fn from(
64 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::associate_member_account::AssociateMemberAccountError, R>,
65 ) -> Self {
66 match err {
67 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
68 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
69 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
70 source: err.into(),
71 }),
72 }
73 }
74}
75impl From<crate::operation::associate_member_account::AssociateMemberAccountError> for Error {
76 fn from(err: crate::operation::associate_member_account::AssociateMemberAccountError) -> Self {
77 match err {
78 crate::operation::associate_member_account::AssociateMemberAccountError::InternalException(inner) => Error::InternalException(inner),
79 crate::operation::associate_member_account::AssociateMemberAccountError::InvalidInputException(inner) => {
80 Error::InvalidInputException(inner)
81 }
82 crate::operation::associate_member_account::AssociateMemberAccountError::LimitExceededException(inner) => {
83 Error::LimitExceededException(inner)
84 }
85 crate::operation::associate_member_account::AssociateMemberAccountError::Unhandled(inner) => Error::Unhandled(inner),
86 }
87 }
88}
89impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::associate_s3_resources::AssociateS3ResourcesError, R>> for Error
90where
91 R: Send + Sync + std::fmt::Debug + 'static,
92{
93 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::associate_s3_resources::AssociateS3ResourcesError, R>) -> Self {
94 match err {
95 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
96 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
97 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
98 source: err.into(),
99 }),
100 }
101 }
102}
103impl From<crate::operation::associate_s3_resources::AssociateS3ResourcesError> for Error {
104 fn from(err: crate::operation::associate_s3_resources::AssociateS3ResourcesError) -> Self {
105 match err {
106 crate::operation::associate_s3_resources::AssociateS3ResourcesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
107 crate::operation::associate_s3_resources::AssociateS3ResourcesError::InternalException(inner) => Error::InternalException(inner),
108 crate::operation::associate_s3_resources::AssociateS3ResourcesError::InvalidInputException(inner) => Error::InvalidInputException(inner),
109 crate::operation::associate_s3_resources::AssociateS3ResourcesError::LimitExceededException(inner) => {
110 Error::LimitExceededException(inner)
111 }
112 crate::operation::associate_s3_resources::AssociateS3ResourcesError::Unhandled(inner) => Error::Unhandled(inner),
113 }
114 }
115}
116impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disassociate_member_account::DisassociateMemberAccountError, R>>
117 for Error
118where
119 R: Send + Sync + std::fmt::Debug + 'static,
120{
121 fn from(
122 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disassociate_member_account::DisassociateMemberAccountError, R>,
123 ) -> Self {
124 match err {
125 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
126 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
127 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
128 source: err.into(),
129 }),
130 }
131 }
132}
133impl From<crate::operation::disassociate_member_account::DisassociateMemberAccountError> for Error {
134 fn from(err: crate::operation::disassociate_member_account::DisassociateMemberAccountError) -> Self {
135 match err {
136 crate::operation::disassociate_member_account::DisassociateMemberAccountError::InternalException(inner) => {
137 Error::InternalException(inner)
138 }
139 crate::operation::disassociate_member_account::DisassociateMemberAccountError::InvalidInputException(inner) => {
140 Error::InvalidInputException(inner)
141 }
142 crate::operation::disassociate_member_account::DisassociateMemberAccountError::Unhandled(inner) => Error::Unhandled(inner),
143 }
144 }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError, R>>
147 for Error
148where
149 R: Send + Sync + std::fmt::Debug + 'static,
150{
151 fn from(
152 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError, R>,
153 ) -> Self {
154 match err {
155 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
156 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
157 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
158 source: err.into(),
159 }),
160 }
161 }
162}
163impl From<crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError> for Error {
164 fn from(err: crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError) -> Self {
165 match err {
166 crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError::AccessDeniedException(inner) => {
167 Error::AccessDeniedException(inner)
168 }
169 crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError::InternalException(inner) => Error::InternalException(inner),
170 crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError::InvalidInputException(inner) => {
171 Error::InvalidInputException(inner)
172 }
173 crate::operation::disassociate_s3_resources::DisassociateS3ResourcesError::Unhandled(inner) => Error::Unhandled(inner),
174 }
175 }
176}
177impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_member_accounts::ListMemberAccountsError, R>> for Error
178where
179 R: Send + Sync + std::fmt::Debug + 'static,
180{
181 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_member_accounts::ListMemberAccountsError, R>) -> Self {
182 match err {
183 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
184 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
185 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
186 source: err.into(),
187 }),
188 }
189 }
190}
191impl From<crate::operation::list_member_accounts::ListMemberAccountsError> for Error {
192 fn from(err: crate::operation::list_member_accounts::ListMemberAccountsError) -> Self {
193 match err {
194 crate::operation::list_member_accounts::ListMemberAccountsError::InternalException(inner) => Error::InternalException(inner),
195 crate::operation::list_member_accounts::ListMemberAccountsError::InvalidInputException(inner) => Error::InvalidInputException(inner),
196 crate::operation::list_member_accounts::ListMemberAccountsError::Unhandled(inner) => Error::Unhandled(inner),
197 }
198 }
199}
200impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_s3_resources::ListS3ResourcesError, R>> for Error
201where
202 R: Send + Sync + std::fmt::Debug + 'static,
203{
204 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_s3_resources::ListS3ResourcesError, R>) -> Self {
205 match err {
206 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
207 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
208 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
209 source: err.into(),
210 }),
211 }
212 }
213}
214impl From<crate::operation::list_s3_resources::ListS3ResourcesError> for Error {
215 fn from(err: crate::operation::list_s3_resources::ListS3ResourcesError) -> Self {
216 match err {
217 crate::operation::list_s3_resources::ListS3ResourcesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
218 crate::operation::list_s3_resources::ListS3ResourcesError::InternalException(inner) => Error::InternalException(inner),
219 crate::operation::list_s3_resources::ListS3ResourcesError::InvalidInputException(inner) => Error::InvalidInputException(inner),
220 crate::operation::list_s3_resources::ListS3ResourcesError::Unhandled(inner) => Error::Unhandled(inner),
221 }
222 }
223}
224impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_s3_resources::UpdateS3ResourcesError, R>> for Error
225where
226 R: Send + Sync + std::fmt::Debug + 'static,
227{
228 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_s3_resources::UpdateS3ResourcesError, R>) -> Self {
229 match err {
230 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
231 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
232 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
233 source: err.into(),
234 }),
235 }
236 }
237}
238impl From<crate::operation::update_s3_resources::UpdateS3ResourcesError> for Error {
239 fn from(err: crate::operation::update_s3_resources::UpdateS3ResourcesError) -> Self {
240 match err {
241 crate::operation::update_s3_resources::UpdateS3ResourcesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
242 crate::operation::update_s3_resources::UpdateS3ResourcesError::InternalException(inner) => Error::InternalException(inner),
243 crate::operation::update_s3_resources::UpdateS3ResourcesError::InvalidInputException(inner) => Error::InvalidInputException(inner),
244 crate::operation::update_s3_resources::UpdateS3ResourcesError::Unhandled(inner) => Error::Unhandled(inner),
245 }
246 }
247}
248impl ::std::error::Error for Error {
249 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
250 match self {
251 Error::AccessDeniedException(inner) => inner.source(),
252 Error::InternalException(inner) => inner.source(),
253 Error::InvalidInputException(inner) => inner.source(),
254 Error::LimitExceededException(inner) => inner.source(),
255 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
256 }
257 }
258}
259impl ::aws_types::request_id::RequestId for Error {
260 fn request_id(&self) -> Option<&str> {
261 match self {
262 Self::AccessDeniedException(e) => e.request_id(),
263 Self::InternalException(e) => e.request_id(),
264 Self::InvalidInputException(e) => e.request_id(),
265 Self::LimitExceededException(e) => e.request_id(),
266 Self::Unhandled(e) => e.meta.request_id(),
267 }
268 }
269}