aws_sdk_observabilityadmin/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 InternalServerException(crate::types::error::InternalServerException),
10 ValidationException(crate::types::error::ValidationException),
12 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
14 variable wildcard pattern and check `.code()`:
15 \
16 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
17 \
18 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
19 Unhandled(crate::error::sealed_unhandled::Unhandled),
20}
21impl ::std::fmt::Display for Error {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 match self {
24 Error::AccessDeniedException(inner) => inner.fmt(f),
25 Error::InternalServerException(inner) => inner.fmt(f),
26 Error::ValidationException(inner) => inner.fmt(f),
27 Error::Unhandled(_) => {
28 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
29 write!(f, "unhandled error ({code})")
30 } else {
31 f.write_str("unhandled error")
32 }
33 }
34 }
35 }
36}
37impl From<::aws_smithy_types::error::operation::BuildError> for Error {
38 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
39 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
40 source: value.into(),
41 meta: ::std::default::Default::default(),
42 })
43 }
44}
45impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
46 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
47 match self {
48 Self::AccessDeniedException(inner) => inner.meta(),
49 Self::InternalServerException(inner) => inner.meta(),
50 Self::ValidationException(inner) => inner.meta(),
51 Self::Unhandled(inner) => &inner.meta,
52 }
53 }
54}
55impl<R>
56 From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError, R>>
57 for Error
58where
59 R: Send + Sync + std::fmt::Debug + 'static,
60{
61 fn from(
62 err: ::aws_smithy_runtime_api::client::result::SdkError<
63 crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError,
64 R,
65 >,
66 ) -> Self {
67 match err {
68 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
69 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
70 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
71 source: err.into(),
72 }),
73 }
74 }
75}
76impl From<crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError> for Error {
77 fn from(err: crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError) -> Self {
78 match err {
79 crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError::AccessDeniedException(inner) => {
80 Error::AccessDeniedException(inner)
81 }
82 crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError::InternalServerException(inner) => {
83 Error::InternalServerException(inner)
84 }
85 crate::operation::get_telemetry_evaluation_status::GetTelemetryEvaluationStatusError::Unhandled(inner) => Error::Unhandled(inner),
86 }
87 }
88}
89impl<R>
90 From<
91 ::aws_smithy_runtime_api::client::result::SdkError<
92 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError,
93 R,
94 >,
95 > for Error
96where
97 R: Send + Sync + std::fmt::Debug + 'static,
98{
99 fn from(
100 err: ::aws_smithy_runtime_api::client::result::SdkError<
101 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError,
102 R,
103 >,
104 ) -> Self {
105 match err {
106 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
107 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
108 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
109 source: err.into(),
110 }),
111 }
112 }
113}
114impl From<crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError> for Error {
115 fn from(err: crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError) -> Self {
116 match err {
117 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
118 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError::InternalServerException(inner) => Error::InternalServerException(inner),
119 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError::ValidationException(inner) => Error::ValidationException(inner),
120 crate::operation::get_telemetry_evaluation_status_for_organization::GetTelemetryEvaluationStatusForOrganizationError::Unhandled(inner) => Error::Unhandled(inner),
121 }
122 }
123}
124impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_resource_telemetry::ListResourceTelemetryError, R>> for Error
125where
126 R: Send + Sync + std::fmt::Debug + 'static,
127{
128 fn from(
129 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_resource_telemetry::ListResourceTelemetryError, R>,
130 ) -> Self {
131 match err {
132 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
133 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
134 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
135 source: err.into(),
136 }),
137 }
138 }
139}
140impl From<crate::operation::list_resource_telemetry::ListResourceTelemetryError> for Error {
141 fn from(err: crate::operation::list_resource_telemetry::ListResourceTelemetryError) -> Self {
142 match err {
143 crate::operation::list_resource_telemetry::ListResourceTelemetryError::AccessDeniedException(inner) => {
144 Error::AccessDeniedException(inner)
145 }
146 crate::operation::list_resource_telemetry::ListResourceTelemetryError::InternalServerException(inner) => {
147 Error::InternalServerException(inner)
148 }
149 crate::operation::list_resource_telemetry::ListResourceTelemetryError::ValidationException(inner) => Error::ValidationException(inner),
150 crate::operation::list_resource_telemetry::ListResourceTelemetryError::Unhandled(inner) => Error::Unhandled(inner),
151 }
152 }
153}
154impl<R>
155 From<
156 ::aws_smithy_runtime_api::client::result::SdkError<
157 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError,
158 R,
159 >,
160 > for Error
161where
162 R: Send + Sync + std::fmt::Debug + 'static,
163{
164 fn from(
165 err: ::aws_smithy_runtime_api::client::result::SdkError<
166 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError,
167 R,
168 >,
169 ) -> Self {
170 match err {
171 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
172 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
173 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
174 source: err.into(),
175 }),
176 }
177 }
178}
179impl From<crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError> for Error {
180 fn from(err: crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError) -> Self {
181 match err {
182 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError::AccessDeniedException(inner) => {
183 Error::AccessDeniedException(inner)
184 }
185 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError::InternalServerException(inner) => {
186 Error::InternalServerException(inner)
187 }
188 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError::ValidationException(inner) => {
189 Error::ValidationException(inner)
190 }
191 crate::operation::list_resource_telemetry_for_organization::ListResourceTelemetryForOrganizationError::Unhandled(inner) => {
192 Error::Unhandled(inner)
193 }
194 }
195 }
196}
197impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError, R>>
198 for Error
199where
200 R: Send + Sync + std::fmt::Debug + 'static,
201{
202 fn from(
203 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError, R>,
204 ) -> 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::start_telemetry_evaluation::StartTelemetryEvaluationError> for Error {
215 fn from(err: crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError) -> Self {
216 match err {
217 crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError::AccessDeniedException(inner) => {
218 Error::AccessDeniedException(inner)
219 }
220 crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError::InternalServerException(inner) => {
221 Error::InternalServerException(inner)
222 }
223 crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError::ValidationException(inner) => {
224 Error::ValidationException(inner)
225 }
226 crate::operation::start_telemetry_evaluation::StartTelemetryEvaluationError::Unhandled(inner) => Error::Unhandled(inner),
227 }
228 }
229}
230impl<R>
231 From<
232 ::aws_smithy_runtime_api::client::result::SdkError<
233 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError,
234 R,
235 >,
236 > for Error
237where
238 R: Send + Sync + std::fmt::Debug + 'static,
239{
240 fn from(
241 err: ::aws_smithy_runtime_api::client::result::SdkError<
242 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError,
243 R,
244 >,
245 ) -> Self {
246 match err {
247 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
248 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
249 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
250 source: err.into(),
251 }),
252 }
253 }
254}
255impl From<crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError> for Error {
256 fn from(err: crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError) -> Self {
257 match err {
258 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError::AccessDeniedException(
259 inner,
260 ) => Error::AccessDeniedException(inner),
261 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError::InternalServerException(
262 inner,
263 ) => Error::InternalServerException(inner),
264 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError::ValidationException(
265 inner,
266 ) => Error::ValidationException(inner),
267 crate::operation::start_telemetry_evaluation_for_organization::StartTelemetryEvaluationForOrganizationError::Unhandled(inner) => {
268 Error::Unhandled(inner)
269 }
270 }
271 }
272}
273impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError, R>>
274 for Error
275where
276 R: Send + Sync + std::fmt::Debug + 'static,
277{
278 fn from(
279 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError, R>,
280 ) -> Self {
281 match err {
282 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
283 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
284 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
285 source: err.into(),
286 }),
287 }
288 }
289}
290impl From<crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError> for Error {
291 fn from(err: crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError) -> Self {
292 match err {
293 crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError::AccessDeniedException(inner) => {
294 Error::AccessDeniedException(inner)
295 }
296 crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError::InternalServerException(inner) => {
297 Error::InternalServerException(inner)
298 }
299 crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError::ValidationException(inner) => {
300 Error::ValidationException(inner)
301 }
302 crate::operation::stop_telemetry_evaluation::StopTelemetryEvaluationError::Unhandled(inner) => Error::Unhandled(inner),
303 }
304 }
305}
306impl<R>
307 From<
308 ::aws_smithy_runtime_api::client::result::SdkError<
309 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError,
310 R,
311 >,
312 > for Error
313where
314 R: Send + Sync + std::fmt::Debug + 'static,
315{
316 fn from(
317 err: ::aws_smithy_runtime_api::client::result::SdkError<
318 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError,
319 R,
320 >,
321 ) -> Self {
322 match err {
323 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
324 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
325 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
326 source: err.into(),
327 }),
328 }
329 }
330}
331impl From<crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError> for Error {
332 fn from(err: crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError) -> Self {
333 match err {
334 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError::AccessDeniedException(
335 inner,
336 ) => Error::AccessDeniedException(inner),
337 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError::InternalServerException(
338 inner,
339 ) => Error::InternalServerException(inner),
340 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError::ValidationException(inner) => {
341 Error::ValidationException(inner)
342 }
343 crate::operation::stop_telemetry_evaluation_for_organization::StopTelemetryEvaluationForOrganizationError::Unhandled(inner) => {
344 Error::Unhandled(inner)
345 }
346 }
347 }
348}
349impl ::std::error::Error for Error {
350 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
351 match self {
352 Error::AccessDeniedException(inner) => inner.source(),
353 Error::InternalServerException(inner) => inner.source(),
354 Error::ValidationException(inner) => inner.source(),
355 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
356 }
357 }
358}
359impl ::aws_types::request_id::RequestId for Error {
360 fn request_id(&self) -> Option<&str> {
361 match self {
362 Self::AccessDeniedException(e) => e.request_id(),
363 Self::InternalServerException(e) => e.request_id(),
364 Self::ValidationException(e) => e.request_id(),
365 Self::Unhandled(e) => e.meta.request_id(),
366 }
367 }
368}