aws_sdk_marketplacereporting/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 BadRequestException(crate::types::error::BadRequestException),
10 InternalServerException(crate::types::error::InternalServerException),
12 UnauthorizedException(crate::types::error::UnauthorizedException),
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::BadRequestException(inner) => inner.fmt(f),
28 Error::InternalServerException(inner) => inner.fmt(f),
29 Error::UnauthorizedException(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::BadRequestException(inner) => inner.meta(),
53 Self::InternalServerException(inner) => inner.meta(),
54 Self::UnauthorizedException(inner) => inner.meta(),
55 Self::Unhandled(inner) => &inner.meta,
56 }
57 }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_buyer_dashboard::GetBuyerDashboardError, 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::get_buyer_dashboard::GetBuyerDashboardError, 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::get_buyer_dashboard::GetBuyerDashboardError> for Error {
74 fn from(err: crate::operation::get_buyer_dashboard::GetBuyerDashboardError) -> Self {
75 match err {
76 crate::operation::get_buyer_dashboard::GetBuyerDashboardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
77 crate::operation::get_buyer_dashboard::GetBuyerDashboardError::BadRequestException(inner) => Error::BadRequestException(inner),
78 crate::operation::get_buyer_dashboard::GetBuyerDashboardError::InternalServerException(inner) => Error::InternalServerException(inner),
79 crate::operation::get_buyer_dashboard::GetBuyerDashboardError::UnauthorizedException(inner) => Error::UnauthorizedException(inner),
80 crate::operation::get_buyer_dashboard::GetBuyerDashboardError::Unhandled(inner) => Error::Unhandled(inner),
81 }
82 }
83}
84impl ::std::error::Error for Error {
85 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
86 match self {
87 Error::AccessDeniedException(inner) => inner.source(),
88 Error::BadRequestException(inner) => inner.source(),
89 Error::InternalServerException(inner) => inner.source(),
90 Error::UnauthorizedException(inner) => inner.source(),
91 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
92 }
93 }
94}
95impl ::aws_types::request_id::RequestId for Error {
96 fn request_id(&self) -> Option<&str> {
97 match self {
98 Self::AccessDeniedException(e) => e.request_id(),
99 Self::BadRequestException(e) => e.request_id(),
100 Self::InternalServerException(e) => e.request_id(),
101 Self::UnauthorizedException(e) => e.request_id(),
102 Self::Unhandled(e) => e.meta.request_id(),
103 }
104 }
105}