1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 InvalidParameterValueException(crate::types::error::InvalidParameterValueException),
8 NetworkConnectorLimitExceededException(crate::types::error::NetworkConnectorLimitExceededException),
10 ResourceConflictException(crate::types::error::ResourceConflictException),
12 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14 ServiceException(crate::types::error::ServiceException),
16 TooManyRequestsException(crate::types::error::TooManyRequestsException),
18 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20 variable wildcard pattern and check `.code()`:
21 \
22 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
23 \
24 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
25 Unhandled(crate::error::sealed_unhandled::Unhandled),
26}
27impl ::std::fmt::Display for Error {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 match self {
30 Error::InvalidParameterValueException(inner) => inner.fmt(f),
31 Error::NetworkConnectorLimitExceededException(inner) => inner.fmt(f),
32 Error::ResourceConflictException(inner) => inner.fmt(f),
33 Error::ResourceNotFoundException(inner) => inner.fmt(f),
34 Error::ServiceException(inner) => inner.fmt(f),
35 Error::TooManyRequestsException(inner) => inner.fmt(f),
36 Error::Unhandled(_) => {
37 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
38 write!(f, "unhandled error ({code})")
39 } else {
40 f.write_str("unhandled error")
41 }
42 }
43 }
44 }
45}
46impl From<::aws_smithy_types::error::operation::BuildError> for Error {
47 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
48 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
49 source: value.into(),
50 meta: ::std::default::Default::default(),
51 })
52 }
53}
54impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
55 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
56 match self {
57 Self::InvalidParameterValueException(inner) => inner.meta(),
58 Self::NetworkConnectorLimitExceededException(inner) => inner.meta(),
59 Self::ResourceConflictException(inner) => inner.meta(),
60 Self::ResourceNotFoundException(inner) => inner.meta(),
61 Self::ServiceException(inner) => inner.meta(),
62 Self::TooManyRequestsException(inner) => inner.meta(),
63 Self::Unhandled(inner) => &inner.meta,
64 }
65 }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_network_connector::CreateNetworkConnectorError, R>> for Error
68where
69 R: Send + Sync + std::fmt::Debug + 'static,
70{
71 fn from(
72 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_network_connector::CreateNetworkConnectorError, R>,
73 ) -> Self {
74 match err {
75 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
76 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
77 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
78 source: err.into(),
79 }),
80 }
81 }
82}
83impl From<crate::operation::create_network_connector::CreateNetworkConnectorError> for Error {
84 fn from(err: crate::operation::create_network_connector::CreateNetworkConnectorError) -> Self {
85 match err {
86 crate::operation::create_network_connector::CreateNetworkConnectorError::InvalidParameterValueException(inner) => {
87 Error::InvalidParameterValueException(inner)
88 }
89 crate::operation::create_network_connector::CreateNetworkConnectorError::NetworkConnectorLimitExceededException(inner) => {
90 Error::NetworkConnectorLimitExceededException(inner)
91 }
92 crate::operation::create_network_connector::CreateNetworkConnectorError::ResourceConflictException(inner) => {
93 Error::ResourceConflictException(inner)
94 }
95 crate::operation::create_network_connector::CreateNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
96 crate::operation::create_network_connector::CreateNetworkConnectorError::TooManyRequestsException(inner) => {
97 Error::TooManyRequestsException(inner)
98 }
99 crate::operation::create_network_connector::CreateNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
100 }
101 }
102}
103impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_network_connector::DeleteNetworkConnectorError, R>> for Error
104where
105 R: Send + Sync + std::fmt::Debug + 'static,
106{
107 fn from(
108 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_network_connector::DeleteNetworkConnectorError, R>,
109 ) -> Self {
110 match err {
111 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
112 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
113 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
114 source: err.into(),
115 }),
116 }
117 }
118}
119impl From<crate::operation::delete_network_connector::DeleteNetworkConnectorError> for Error {
120 fn from(err: crate::operation::delete_network_connector::DeleteNetworkConnectorError) -> Self {
121 match err {
122 crate::operation::delete_network_connector::DeleteNetworkConnectorError::InvalidParameterValueException(inner) => {
123 Error::InvalidParameterValueException(inner)
124 }
125 crate::operation::delete_network_connector::DeleteNetworkConnectorError::ResourceConflictException(inner) => {
126 Error::ResourceConflictException(inner)
127 }
128 crate::operation::delete_network_connector::DeleteNetworkConnectorError::ResourceNotFoundException(inner) => {
129 Error::ResourceNotFoundException(inner)
130 }
131 crate::operation::delete_network_connector::DeleteNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
132 crate::operation::delete_network_connector::DeleteNetworkConnectorError::TooManyRequestsException(inner) => {
133 Error::TooManyRequestsException(inner)
134 }
135 crate::operation::delete_network_connector::DeleteNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
136 }
137 }
138}
139impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_network_connector::GetNetworkConnectorError, R>> for Error
140where
141 R: Send + Sync + std::fmt::Debug + 'static,
142{
143 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_network_connector::GetNetworkConnectorError, R>) -> Self {
144 match err {
145 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
146 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
147 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
148 source: err.into(),
149 }),
150 }
151 }
152}
153impl From<crate::operation::get_network_connector::GetNetworkConnectorError> for Error {
154 fn from(err: crate::operation::get_network_connector::GetNetworkConnectorError) -> Self {
155 match err {
156 crate::operation::get_network_connector::GetNetworkConnectorError::InvalidParameterValueException(inner) => {
157 Error::InvalidParameterValueException(inner)
158 }
159 crate::operation::get_network_connector::GetNetworkConnectorError::ResourceNotFoundException(inner) => {
160 Error::ResourceNotFoundException(inner)
161 }
162 crate::operation::get_network_connector::GetNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
163 crate::operation::get_network_connector::GetNetworkConnectorError::TooManyRequestsException(inner) => {
164 Error::TooManyRequestsException(inner)
165 }
166 crate::operation::get_network_connector::GetNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
167 }
168 }
169}
170impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_network_connectors::ListNetworkConnectorsError, R>> for Error
171where
172 R: Send + Sync + std::fmt::Debug + 'static,
173{
174 fn from(
175 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_network_connectors::ListNetworkConnectorsError, R>,
176 ) -> Self {
177 match err {
178 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
179 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
180 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
181 source: err.into(),
182 }),
183 }
184 }
185}
186impl From<crate::operation::list_network_connectors::ListNetworkConnectorsError> for Error {
187 fn from(err: crate::operation::list_network_connectors::ListNetworkConnectorsError) -> Self {
188 match err {
189 crate::operation::list_network_connectors::ListNetworkConnectorsError::InvalidParameterValueException(inner) => {
190 Error::InvalidParameterValueException(inner)
191 }
192 crate::operation::list_network_connectors::ListNetworkConnectorsError::ServiceException(inner) => Error::ServiceException(inner),
193 crate::operation::list_network_connectors::ListNetworkConnectorsError::TooManyRequestsException(inner) => {
194 Error::TooManyRequestsException(inner)
195 }
196 crate::operation::list_network_connectors::ListNetworkConnectorsError::Unhandled(inner) => Error::Unhandled(inner),
197 }
198 }
199}
200impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_network_connector::UpdateNetworkConnectorError, R>> for Error
201where
202 R: Send + Sync + std::fmt::Debug + 'static,
203{
204 fn from(
205 err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_network_connector::UpdateNetworkConnectorError, R>,
206 ) -> Self {
207 match err {
208 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
209 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
210 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
211 source: err.into(),
212 }),
213 }
214 }
215}
216impl From<crate::operation::update_network_connector::UpdateNetworkConnectorError> for Error {
217 fn from(err: crate::operation::update_network_connector::UpdateNetworkConnectorError) -> Self {
218 match err {
219 crate::operation::update_network_connector::UpdateNetworkConnectorError::InvalidParameterValueException(inner) => {
220 Error::InvalidParameterValueException(inner)
221 }
222 crate::operation::update_network_connector::UpdateNetworkConnectorError::ResourceConflictException(inner) => {
223 Error::ResourceConflictException(inner)
224 }
225 crate::operation::update_network_connector::UpdateNetworkConnectorError::ResourceNotFoundException(inner) => {
226 Error::ResourceNotFoundException(inner)
227 }
228 crate::operation::update_network_connector::UpdateNetworkConnectorError::ServiceException(inner) => Error::ServiceException(inner),
229 crate::operation::update_network_connector::UpdateNetworkConnectorError::TooManyRequestsException(inner) => {
230 Error::TooManyRequestsException(inner)
231 }
232 crate::operation::update_network_connector::UpdateNetworkConnectorError::Unhandled(inner) => Error::Unhandled(inner),
233 }
234 }
235}
236impl ::std::error::Error for Error {
237 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
238 match self {
239 Error::InvalidParameterValueException(inner) => inner.source(),
240 Error::NetworkConnectorLimitExceededException(inner) => inner.source(),
241 Error::ResourceConflictException(inner) => inner.source(),
242 Error::ResourceNotFoundException(inner) => inner.source(),
243 Error::ServiceException(inner) => inner.source(),
244 Error::TooManyRequestsException(inner) => inner.source(),
245 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
246 }
247 }
248}
249impl ::aws_types::request_id::RequestId for Error {
250 fn request_id(&self) -> Option<&str> {
251 match self {
252 Self::InvalidParameterValueException(e) => e.request_id(),
253 Self::NetworkConnectorLimitExceededException(e) => e.request_id(),
254 Self::ResourceConflictException(e) => e.request_id(),
255 Self::ResourceNotFoundException(e) => e.request_id(),
256 Self::ServiceException(e) => e.request_id(),
257 Self::TooManyRequestsException(e) => e.request_id(),
258 Self::Unhandled(e) => e.meta.request_id(),
259 }
260 }
261}