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