1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 ConflictException(crate::types::error::ConflictException),
10 InternalServerException(crate::types::error::InternalServerException),
12 OutpostOfflineException(crate::types::error::OutpostOfflineException),
14 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
16 ThrottlingException(crate::types::error::ThrottlingException),
18 ValidationException(crate::types::error::ValidationException),
20 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22 variable wildcard pattern and check `.code()`:
23 \
24 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
25 \
26 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
27 Unhandled(crate::error::sealed_unhandled::Unhandled),
28}
29impl ::std::fmt::Display for Error {
30 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31 match self {
32 Error::AccessDeniedException(inner) => inner.fmt(f),
33 Error::ConflictException(inner) => inner.fmt(f),
34 Error::InternalServerException(inner) => inner.fmt(f),
35 Error::OutpostOfflineException(inner) => inner.fmt(f),
36 Error::ResourceNotFoundException(inner) => inner.fmt(f),
37 Error::ThrottlingException(inner) => inner.fmt(f),
38 Error::ValidationException(inner) => inner.fmt(f),
39 Error::Unhandled(_) => {
40 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
41 write!(f, "unhandled error ({code})")
42 } else {
43 f.write_str("unhandled error")
44 }
45 }
46 }
47 }
48}
49impl From<::aws_smithy_types::error::operation::BuildError> for Error {
50 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
51 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
52 source: value.into(),
53 meta: ::std::default::Default::default(),
54 })
55 }
56}
57impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
58 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
59 match self {
60 Self::AccessDeniedException(inner) => inner.meta(),
61 Self::ConflictException(inner) => inner.meta(),
62 Self::InternalServerException(inner) => inner.meta(),
63 Self::OutpostOfflineException(inner) => inner.meta(),
64 Self::ResourceNotFoundException(inner) => inner.meta(),
65 Self::ThrottlingException(inner) => inner.meta(),
66 Self::ValidationException(inner) => inner.meta(),
67 Self::Unhandled(inner) => &inner.meta,
68 }
69 }
70}
71impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_endpoint::CreateEndpointError, R>> for Error
72where
73 R: Send + Sync + std::fmt::Debug + 'static,
74{
75 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_endpoint::CreateEndpointError, R>) -> Self {
76 match err {
77 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
78 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
79 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
80 source: err.into(),
81 }),
82 }
83 }
84}
85impl From<crate::operation::create_endpoint::CreateEndpointError> for Error {
86 fn from(err: crate::operation::create_endpoint::CreateEndpointError) -> Self {
87 match err {
88 crate::operation::create_endpoint::CreateEndpointError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89 crate::operation::create_endpoint::CreateEndpointError::ConflictException(inner) => Error::ConflictException(inner),
90 crate::operation::create_endpoint::CreateEndpointError::InternalServerException(inner) => Error::InternalServerException(inner),
91 crate::operation::create_endpoint::CreateEndpointError::OutpostOfflineException(inner) => Error::OutpostOfflineException(inner),
92 crate::operation::create_endpoint::CreateEndpointError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
93 crate::operation::create_endpoint::CreateEndpointError::ThrottlingException(inner) => Error::ThrottlingException(inner),
94 crate::operation::create_endpoint::CreateEndpointError::ValidationException(inner) => Error::ValidationException(inner),
95 crate::operation::create_endpoint::CreateEndpointError::Unhandled(inner) => Error::Unhandled(inner),
96 }
97 }
98}
99impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_endpoint::DeleteEndpointError, 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::delete_endpoint::DeleteEndpointError, 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::delete_endpoint::DeleteEndpointError> for Error {
114 fn from(err: crate::operation::delete_endpoint::DeleteEndpointError) -> Self {
115 match err {
116 crate::operation::delete_endpoint::DeleteEndpointError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
117 crate::operation::delete_endpoint::DeleteEndpointError::InternalServerException(inner) => Error::InternalServerException(inner),
118 crate::operation::delete_endpoint::DeleteEndpointError::OutpostOfflineException(inner) => Error::OutpostOfflineException(inner),
119 crate::operation::delete_endpoint::DeleteEndpointError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
120 crate::operation::delete_endpoint::DeleteEndpointError::ThrottlingException(inner) => Error::ThrottlingException(inner),
121 crate::operation::delete_endpoint::DeleteEndpointError::ValidationException(inner) => Error::ValidationException(inner),
122 crate::operation::delete_endpoint::DeleteEndpointError::Unhandled(inner) => Error::Unhandled(inner),
123 }
124 }
125}
126impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_endpoints::ListEndpointsError, R>> for Error
127where
128 R: Send + Sync + std::fmt::Debug + 'static,
129{
130 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_endpoints::ListEndpointsError, R>) -> 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_endpoints::ListEndpointsError> for Error {
141 fn from(err: crate::operation::list_endpoints::ListEndpointsError) -> Self {
142 match err {
143 crate::operation::list_endpoints::ListEndpointsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
144 crate::operation::list_endpoints::ListEndpointsError::InternalServerException(inner) => Error::InternalServerException(inner),
145 crate::operation::list_endpoints::ListEndpointsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
146 crate::operation::list_endpoints::ListEndpointsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
147 crate::operation::list_endpoints::ListEndpointsError::ValidationException(inner) => Error::ValidationException(inner),
148 crate::operation::list_endpoints::ListEndpointsError::Unhandled(inner) => Error::Unhandled(inner),
149 }
150 }
151}
152impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error, 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::list_outposts_with_s3::ListOutpostsWithS3Error, 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::list_outposts_with_s3::ListOutpostsWithS3Error> for Error {
167 fn from(err: crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error) -> Self {
168 match err {
169 crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
170 crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::InternalServerException(inner) => Error::InternalServerException(inner),
171 crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::ThrottlingException(inner) => Error::ThrottlingException(inner),
172 crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::ValidationException(inner) => Error::ValidationException(inner),
173 crate::operation::list_outposts_with_s3::ListOutpostsWithS3Error::Unhandled(inner) => Error::Unhandled(inner),
174 }
175 }
176}
177impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_shared_endpoints::ListSharedEndpointsError, R>> for Error
178where
179 R: Send + Sync + std::fmt::Debug + 'static,
180{
181 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_shared_endpoints::ListSharedEndpointsError, R>) -> Self {
182 match err {
183 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
184 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
185 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
186 source: err.into(),
187 }),
188 }
189 }
190}
191impl From<crate::operation::list_shared_endpoints::ListSharedEndpointsError> for Error {
192 fn from(err: crate::operation::list_shared_endpoints::ListSharedEndpointsError) -> Self {
193 match err {
194 crate::operation::list_shared_endpoints::ListSharedEndpointsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
195 crate::operation::list_shared_endpoints::ListSharedEndpointsError::InternalServerException(inner) => {
196 Error::InternalServerException(inner)
197 }
198 crate::operation::list_shared_endpoints::ListSharedEndpointsError::ResourceNotFoundException(inner) => {
199 Error::ResourceNotFoundException(inner)
200 }
201 crate::operation::list_shared_endpoints::ListSharedEndpointsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
202 crate::operation::list_shared_endpoints::ListSharedEndpointsError::ValidationException(inner) => Error::ValidationException(inner),
203 crate::operation::list_shared_endpoints::ListSharedEndpointsError::Unhandled(inner) => Error::Unhandled(inner),
204 }
205 }
206}
207impl ::std::error::Error for Error {
208 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
209 match self {
210 Error::AccessDeniedException(inner) => inner.source(),
211 Error::ConflictException(inner) => inner.source(),
212 Error::InternalServerException(inner) => inner.source(),
213 Error::OutpostOfflineException(inner) => inner.source(),
214 Error::ResourceNotFoundException(inner) => inner.source(),
215 Error::ThrottlingException(inner) => inner.source(),
216 Error::ValidationException(inner) => inner.source(),
217 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
218 }
219 }
220}
221impl ::aws_types::request_id::RequestId for Error {
222 fn request_id(&self) -> Option<&str> {
223 match self {
224 Self::AccessDeniedException(e) => e.request_id(),
225 Self::ConflictException(e) => e.request_id(),
226 Self::InternalServerException(e) => e.request_id(),
227 Self::OutpostOfflineException(e) => e.request_id(),
228 Self::ResourceNotFoundException(e) => e.request_id(),
229 Self::ThrottlingException(e) => e.request_id(),
230 Self::ValidationException(e) => e.request_id(),
231 Self::Unhandled(e) => e.meta.request_id(),
232 }
233 }
234}