1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 InternalServerException(crate::types::error::InternalServerException),
10 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12 ThrottlingException(crate::types::error::ThrottlingException),
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::AccessDeniedException(inner) => inner.fmt(f),
29 Error::InternalServerException(inner) => inner.fmt(f),
30 Error::ResourceNotFoundException(inner) => inner.fmt(f),
31 Error::ThrottlingException(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::AccessDeniedException(inner) => inner.meta(),
55 Self::InternalServerException(inner) => inner.meta(),
56 Self::ResourceNotFoundException(inner) => inner.meta(),
57 Self::ThrottlingException(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::get_account_activity::GetAccountActivityError, R>> for Error
64where
65 R: Send + Sync + std::fmt::Debug + 'static,
66{
67 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_activity::GetAccountActivityError, R>) -> Self {
68 match err {
69 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
70 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
71 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
72 source: err.into(),
73 }),
74 }
75 }
76}
77impl From<crate::operation::get_account_activity::GetAccountActivityError> for Error {
78 fn from(err: crate::operation::get_account_activity::GetAccountActivityError) -> Self {
79 match err {
80 crate::operation::get_account_activity::GetAccountActivityError::InternalServerException(inner) => Error::InternalServerException(inner),
81 crate::operation::get_account_activity::GetAccountActivityError::ResourceNotFoundException(inner) => {
82 Error::ResourceNotFoundException(inner)
83 }
84 crate::operation::get_account_activity::GetAccountActivityError::ThrottlingException(inner) => Error::ThrottlingException(inner),
85 crate::operation::get_account_activity::GetAccountActivityError::ValidationException(inner) => Error::ValidationException(inner),
86 crate::operation::get_account_activity::GetAccountActivityError::Unhandled(inner) => Error::Unhandled(inner),
87 }
88 }
89}
90impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_plan_state::GetAccountPlanStateError, R>> for Error
91where
92 R: Send + Sync + std::fmt::Debug + 'static,
93{
94 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_plan_state::GetAccountPlanStateError, R>) -> Self {
95 match err {
96 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
97 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
98 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
99 source: err.into(),
100 }),
101 }
102 }
103}
104impl From<crate::operation::get_account_plan_state::GetAccountPlanStateError> for Error {
105 fn from(err: crate::operation::get_account_plan_state::GetAccountPlanStateError) -> Self {
106 match err {
107 crate::operation::get_account_plan_state::GetAccountPlanStateError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
108 crate::operation::get_account_plan_state::GetAccountPlanStateError::InternalServerException(inner) => {
109 Error::InternalServerException(inner)
110 }
111 crate::operation::get_account_plan_state::GetAccountPlanStateError::ResourceNotFoundException(inner) => {
112 Error::ResourceNotFoundException(inner)
113 }
114 crate::operation::get_account_plan_state::GetAccountPlanStateError::ThrottlingException(inner) => Error::ThrottlingException(inner),
115 crate::operation::get_account_plan_state::GetAccountPlanStateError::ValidationException(inner) => Error::ValidationException(inner),
116 crate::operation::get_account_plan_state::GetAccountPlanStateError::Unhandled(inner) => Error::Unhandled(inner),
117 }
118 }
119}
120impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_free_tier_usage::GetFreeTierUsageError, R>> for Error
121where
122 R: Send + Sync + std::fmt::Debug + 'static,
123{
124 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_free_tier_usage::GetFreeTierUsageError, R>) -> Self {
125 match err {
126 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
127 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
128 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
129 source: err.into(),
130 }),
131 }
132 }
133}
134impl From<crate::operation::get_free_tier_usage::GetFreeTierUsageError> for Error {
135 fn from(err: crate::operation::get_free_tier_usage::GetFreeTierUsageError) -> Self {
136 match err {
137 crate::operation::get_free_tier_usage::GetFreeTierUsageError::InternalServerException(inner) => Error::InternalServerException(inner),
138 crate::operation::get_free_tier_usage::GetFreeTierUsageError::ThrottlingException(inner) => Error::ThrottlingException(inner),
139 crate::operation::get_free_tier_usage::GetFreeTierUsageError::ValidationException(inner) => Error::ValidationException(inner),
140 crate::operation::get_free_tier_usage::GetFreeTierUsageError::Unhandled(inner) => Error::Unhandled(inner),
141 }
142 }
143}
144impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_account_activities::ListAccountActivitiesError, R>> for Error
145where
146 R: Send + Sync + std::fmt::Debug + 'static,
147{
148 fn from(
149 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_account_activities::ListAccountActivitiesError, R>,
150 ) -> Self {
151 match err {
152 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
154 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
155 source: err.into(),
156 }),
157 }
158 }
159}
160impl From<crate::operation::list_account_activities::ListAccountActivitiesError> for Error {
161 fn from(err: crate::operation::list_account_activities::ListAccountActivitiesError) -> Self {
162 match err {
163 crate::operation::list_account_activities::ListAccountActivitiesError::InternalServerException(inner) => {
164 Error::InternalServerException(inner)
165 }
166 crate::operation::list_account_activities::ListAccountActivitiesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
167 crate::operation::list_account_activities::ListAccountActivitiesError::ValidationException(inner) => Error::ValidationException(inner),
168 crate::operation::list_account_activities::ListAccountActivitiesError::Unhandled(inner) => Error::Unhandled(inner),
169 }
170 }
171}
172impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::upgrade_account_plan::UpgradeAccountPlanError, R>> for Error
173where
174 R: Send + Sync + std::fmt::Debug + 'static,
175{
176 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::upgrade_account_plan::UpgradeAccountPlanError, R>) -> Self {
177 match err {
178 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
179 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
180 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
181 source: err.into(),
182 }),
183 }
184 }
185}
186impl From<crate::operation::upgrade_account_plan::UpgradeAccountPlanError> for Error {
187 fn from(err: crate::operation::upgrade_account_plan::UpgradeAccountPlanError) -> Self {
188 match err {
189 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
190 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::InternalServerException(inner) => Error::InternalServerException(inner),
191 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::ResourceNotFoundException(inner) => {
192 Error::ResourceNotFoundException(inner)
193 }
194 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::ThrottlingException(inner) => Error::ThrottlingException(inner),
195 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::ValidationException(inner) => Error::ValidationException(inner),
196 crate::operation::upgrade_account_plan::UpgradeAccountPlanError::Unhandled(inner) => Error::Unhandled(inner),
197 }
198 }
199}
200impl ::std::error::Error for Error {
201 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
202 match self {
203 Error::AccessDeniedException(inner) => inner.source(),
204 Error::InternalServerException(inner) => inner.source(),
205 Error::ResourceNotFoundException(inner) => inner.source(),
206 Error::ThrottlingException(inner) => inner.source(),
207 Error::ValidationException(inner) => inner.source(),
208 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
209 }
210 }
211}
212impl ::aws_types::request_id::RequestId for Error {
213 fn request_id(&self) -> Option<&str> {
214 match self {
215 Self::AccessDeniedException(e) => e.request_id(),
216 Self::InternalServerException(e) => e.request_id(),
217 Self::ResourceNotFoundException(e) => e.request_id(),
218 Self::ThrottlingException(e) => e.request_id(),
219 Self::ValidationException(e) => e.request_id(),
220 Self::Unhandled(e) => e.meta.request_id(),
221 }
222 }
223}