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