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::batch_get_financial_record::BatchGetFinancialRecordError, R>>
64 for Error
65where
66 R: Send + Sync + std::fmt::Debug + 'static,
67{
68 fn from(
69 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::batch_get_financial_record::BatchGetFinancialRecordError, R>,
70 ) -> Self {
71 match err {
72 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
73 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
74 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
75 source: err.into(),
76 }),
77 }
78 }
79}
80impl From<crate::operation::batch_get_financial_record::BatchGetFinancialRecordError> for Error {
81 fn from(err: crate::operation::batch_get_financial_record::BatchGetFinancialRecordError) -> Self {
82 match err {
83 crate::operation::batch_get_financial_record::BatchGetFinancialRecordError::AccessDeniedException(inner) => {
84 Error::AccessDeniedException(inner)
85 }
86 crate::operation::batch_get_financial_record::BatchGetFinancialRecordError::InternalServerException(inner) => {
87 Error::InternalServerException(inner)
88 }
89 crate::operation::batch_get_financial_record::BatchGetFinancialRecordError::ThrottlingException(inner) => {
90 Error::ThrottlingException(inner)
91 }
92 crate::operation::batch_get_financial_record::BatchGetFinancialRecordError::ValidationException(inner) => {
93 Error::ValidationException(inner)
94 }
95 crate::operation::batch_get_financial_record::BatchGetFinancialRecordError::Unhandled(inner) => Error::Unhandled(inner),
96 }
97 }
98}
99impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_balance::GetAccountBalanceError, R>> for Error
100where
101 R: Send + Sync + std::fmt::Debug + 'static,
102{
103 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_account_balance::GetAccountBalanceError, R>) -> Self {
104 match err {
105 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
106 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
107 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
108 source: err.into(),
109 }),
110 }
111 }
112}
113impl From<crate::operation::get_account_balance::GetAccountBalanceError> for Error {
114 fn from(err: crate::operation::get_account_balance::GetAccountBalanceError) -> Self {
115 match err {
116 crate::operation::get_account_balance::GetAccountBalanceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
117 crate::operation::get_account_balance::GetAccountBalanceError::InternalServerException(inner) => Error::InternalServerException(inner),
118 crate::operation::get_account_balance::GetAccountBalanceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
119 crate::operation::get_account_balance::GetAccountBalanceError::ValidationException(inner) => Error::ValidationException(inner),
120 crate::operation::get_account_balance::GetAccountBalanceError::Unhandled(inner) => Error::Unhandled(inner),
121 }
122 }
123}
124impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_financial_record::GetFinancialRecordError, R>> for Error
125where
126 R: Send + Sync + std::fmt::Debug + 'static,
127{
128 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_financial_record::GetFinancialRecordError, R>) -> Self {
129 match err {
130 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
131 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
132 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
133 source: err.into(),
134 }),
135 }
136 }
137}
138impl From<crate::operation::get_financial_record::GetFinancialRecordError> for Error {
139 fn from(err: crate::operation::get_financial_record::GetFinancialRecordError) -> Self {
140 match err {
141 crate::operation::get_financial_record::GetFinancialRecordError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
142 crate::operation::get_financial_record::GetFinancialRecordError::InternalServerException(inner) => Error::InternalServerException(inner),
143 crate::operation::get_financial_record::GetFinancialRecordError::ResourceNotFoundException(inner) => {
144 Error::ResourceNotFoundException(inner)
145 }
146 crate::operation::get_financial_record::GetFinancialRecordError::ThrottlingException(inner) => Error::ThrottlingException(inner),
147 crate::operation::get_financial_record::GetFinancialRecordError::ValidationException(inner) => Error::ValidationException(inner),
148 crate::operation::get_financial_record::GetFinancialRecordError::Unhandled(inner) => Error::Unhandled(inner),
149 }
150 }
151}
152impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_payment_instrument::GetPaymentInstrumentError, R>> for Error
153where
154 R: Send + Sync + std::fmt::Debug + 'static,
155{
156 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_payment_instrument::GetPaymentInstrumentError, R>) -> Self {
157 match err {
158 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
159 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
160 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
161 source: err.into(),
162 }),
163 }
164 }
165}
166impl From<crate::operation::get_payment_instrument::GetPaymentInstrumentError> for Error {
167 fn from(err: crate::operation::get_payment_instrument::GetPaymentInstrumentError) -> Self {
168 match err {
169 crate::operation::get_payment_instrument::GetPaymentInstrumentError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
170 crate::operation::get_payment_instrument::GetPaymentInstrumentError::InternalServerException(inner) => {
171 Error::InternalServerException(inner)
172 }
173 crate::operation::get_payment_instrument::GetPaymentInstrumentError::ResourceNotFoundException(inner) => {
174 Error::ResourceNotFoundException(inner)
175 }
176 crate::operation::get_payment_instrument::GetPaymentInstrumentError::ThrottlingException(inner) => Error::ThrottlingException(inner),
177 crate::operation::get_payment_instrument::GetPaymentInstrumentError::ValidationException(inner) => Error::ValidationException(inner),
178 crate::operation::get_payment_instrument::GetPaymentInstrumentError::Unhandled(inner) => Error::Unhandled(inner),
179 }
180 }
181}
182impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_financial_records::ListFinancialRecordsError, R>> for Error
183where
184 R: Send + Sync + std::fmt::Debug + 'static,
185{
186 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_financial_records::ListFinancialRecordsError, R>) -> Self {
187 match err {
188 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
189 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
190 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
191 source: err.into(),
192 }),
193 }
194 }
195}
196impl From<crate::operation::list_financial_records::ListFinancialRecordsError> for Error {
197 fn from(err: crate::operation::list_financial_records::ListFinancialRecordsError) -> Self {
198 match err {
199 crate::operation::list_financial_records::ListFinancialRecordsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
200 crate::operation::list_financial_records::ListFinancialRecordsError::InternalServerException(inner) => {
201 Error::InternalServerException(inner)
202 }
203 crate::operation::list_financial_records::ListFinancialRecordsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
204 crate::operation::list_financial_records::ListFinancialRecordsError::ValidationException(inner) => Error::ValidationException(inner),
205 crate::operation::list_financial_records::ListFinancialRecordsError::Unhandled(inner) => Error::Unhandled(inner),
206 }
207 }
208}
209impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_payment_instruments::ListPaymentInstrumentsError, R>> for Error
210where
211 R: Send + Sync + std::fmt::Debug + 'static,
212{
213 fn from(
214 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_payment_instruments::ListPaymentInstrumentsError, R>,
215 ) -> Self {
216 match err {
217 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
218 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
219 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
220 source: err.into(),
221 }),
222 }
223 }
224}
225impl From<crate::operation::list_payment_instruments::ListPaymentInstrumentsError> for Error {
226 fn from(err: crate::operation::list_payment_instruments::ListPaymentInstrumentsError) -> Self {
227 match err {
228 crate::operation::list_payment_instruments::ListPaymentInstrumentsError::AccessDeniedException(inner) => {
229 Error::AccessDeniedException(inner)
230 }
231 crate::operation::list_payment_instruments::ListPaymentInstrumentsError::InternalServerException(inner) => {
232 Error::InternalServerException(inner)
233 }
234 crate::operation::list_payment_instruments::ListPaymentInstrumentsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
235 crate::operation::list_payment_instruments::ListPaymentInstrumentsError::ValidationException(inner) => Error::ValidationException(inner),
236 crate::operation::list_payment_instruments::ListPaymentInstrumentsError::Unhandled(inner) => Error::Unhandled(inner),
237 }
238 }
239}
240impl ::std::error::Error for Error {
241 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
242 match self {
243 Error::AccessDeniedException(inner) => inner.source(),
244 Error::InternalServerException(inner) => inner.source(),
245 Error::ResourceNotFoundException(inner) => inner.source(),
246 Error::ThrottlingException(inner) => inner.source(),
247 Error::ValidationException(inner) => inner.source(),
248 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
249 }
250 }
251}
252impl ::aws_types::request_id::RequestId for Error {
253 fn request_id(&self) -> Option<&str> {
254 match self {
255 Self::AccessDeniedException(e) => e.request_id(),
256 Self::InternalServerException(e) => e.request_id(),
257 Self::ResourceNotFoundException(e) => e.request_id(),
258 Self::ThrottlingException(e) => e.request_id(),
259 Self::ValidationException(e) => e.request_id(),
260 Self::Unhandled(e) => e.meta.request_id(),
261 }
262 }
263}