aws_sdk_marketplacecommerceanalytics/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 MarketplaceCommerceAnalyticsException(crate::types::error::MarketplaceCommerceAnalyticsException),
8 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
10 variable wildcard pattern and check `.code()`:
11 \
12 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
13 \
14 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
15 Unhandled(crate::error::sealed_unhandled::Unhandled),
16}
17impl ::std::fmt::Display for Error {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 match self {
20 Error::MarketplaceCommerceAnalyticsException(inner) => inner.fmt(f),
21 Error::Unhandled(_) => {
22 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
23 write!(f, "unhandled error ({code})")
24 } else {
25 f.write_str("unhandled error")
26 }
27 }
28 }
29 }
30}
31impl From<::aws_smithy_types::error::operation::BuildError> for Error {
32 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
33 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
34 source: value.into(),
35 meta: ::std::default::Default::default(),
36 })
37 }
38}
39impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
40 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
41 match self {
42 Self::MarketplaceCommerceAnalyticsException(inner) => inner.meta(),
43 Self::Unhandled(inner) => &inner.meta,
44 }
45 }
46}
47impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::generate_data_set::GenerateDataSetError, R>> for Error
48where
49 R: Send + Sync + std::fmt::Debug + 'static,
50{
51 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::generate_data_set::GenerateDataSetError, R>) -> Self {
52 match err {
53 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
54 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
55 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
56 source: err.into(),
57 }),
58 }
59 }
60}
61impl From<crate::operation::generate_data_set::GenerateDataSetError> for Error {
62 fn from(err: crate::operation::generate_data_set::GenerateDataSetError) -> Self {
63 match err {
64 crate::operation::generate_data_set::GenerateDataSetError::MarketplaceCommerceAnalyticsException(inner) => {
65 Error::MarketplaceCommerceAnalyticsException(inner)
66 }
67 crate::operation::generate_data_set::GenerateDataSetError::Unhandled(inner) => Error::Unhandled(inner),
68 }
69 }
70}
71impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_support_data_export::StartSupportDataExportError, R>>
72 for Error
73where
74 R: Send + Sync + std::fmt::Debug + 'static,
75{
76 fn from(
77 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_support_data_export::StartSupportDataExportError, R>,
78 ) -> Self {
79 match err {
80 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
81 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
82 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
83 source: err.into(),
84 }),
85 }
86 }
87}
88impl From<crate::operation::start_support_data_export::StartSupportDataExportError> for Error {
89 fn from(err: crate::operation::start_support_data_export::StartSupportDataExportError) -> Self {
90 match err {
91 crate::operation::start_support_data_export::StartSupportDataExportError::MarketplaceCommerceAnalyticsException(inner) => {
92 Error::MarketplaceCommerceAnalyticsException(inner)
93 }
94 crate::operation::start_support_data_export::StartSupportDataExportError::Unhandled(inner) => Error::Unhandled(inner),
95 }
96 }
97}
98impl ::std::error::Error for Error {
99 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
100 match self {
101 Error::MarketplaceCommerceAnalyticsException(inner) => inner.source(),
102 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
103 }
104 }
105}
106impl ::aws_types::request_id::RequestId for Error {
107 fn request_id(&self) -> Option<&str> {
108 match self {
109 Self::MarketplaceCommerceAnalyticsException(e) => e.request_id(),
110 Self::Unhandled(e) => e.meta.request_id(),
111 }
112 }
113}