aws_sdk_controlcatalog/
error_meta.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// All possible error types for this service.
3#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6    /// <p>You do not have sufficient access to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>An internal service error occurred during the processing of your request. Try again later.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>The requested resource does not exist.</p>
11    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
12    /// <p>The request was denied due to request throttling.</p>
13    ThrottlingException(crate::types::error::ThrottlingException),
14    /// <p>The request has invalid or missing parameters.</p>
15    ValidationException(crate::types::error::ValidationException),
16    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
17    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
18    variable wildcard pattern and check `.code()`:
19     \
20    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
21     \
22    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
23    Unhandled(crate::error::sealed_unhandled::Unhandled),
24}
25impl ::std::fmt::Display for Error {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Error::AccessDeniedException(inner) => inner.fmt(f),
29            Error::InternalServerException(inner) => inner.fmt(f),
30            Error::ResourceNotFoundException(inner) => inner.fmt(f),
31            Error::ThrottlingException(inner) => inner.fmt(f),
32            Error::ValidationException(inner) => inner.fmt(f),
33            Error::Unhandled(_) => {
34                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
35                    write!(f, "unhandled error ({code})")
36                } else {
37                    f.write_str("unhandled error")
38                }
39            }
40        }
41    }
42}
43impl From<::aws_smithy_types::error::operation::BuildError> for Error {
44    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
45        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
46            source: value.into(),
47            meta: ::std::default::Default::default(),
48        })
49    }
50}
51impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
52    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
53        match self {
54            Self::AccessDeniedException(inner) => inner.meta(),
55            Self::InternalServerException(inner) => inner.meta(),
56            Self::ResourceNotFoundException(inner) => inner.meta(),
57            Self::ThrottlingException(inner) => inner.meta(),
58            Self::ValidationException(inner) => inner.meta(),
59            Self::Unhandled(inner) => &inner.meta,
60        }
61    }
62}
63impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_control::GetControlError, R>> for Error
64where
65    R: Send + Sync + std::fmt::Debug + 'static,
66{
67    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_control::GetControlError, R>) -> Self {
68        match err {
69            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
70            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
71                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
72                source: err.into(),
73            }),
74        }
75    }
76}
77impl From<crate::operation::get_control::GetControlError> for Error {
78    fn from(err: crate::operation::get_control::GetControlError) -> Self {
79        match err {
80            crate::operation::get_control::GetControlError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
81            crate::operation::get_control::GetControlError::InternalServerException(inner) => Error::InternalServerException(inner),
82            crate::operation::get_control::GetControlError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
83            crate::operation::get_control::GetControlError::ThrottlingException(inner) => Error::ThrottlingException(inner),
84            crate::operation::get_control::GetControlError::ValidationException(inner) => Error::ValidationException(inner),
85            crate::operation::get_control::GetControlError::Unhandled(inner) => Error::Unhandled(inner),
86        }
87    }
88}
89impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_common_controls::ListCommonControlsError, R>> for Error
90where
91    R: Send + Sync + std::fmt::Debug + 'static,
92{
93    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_common_controls::ListCommonControlsError, R>) -> Self {
94        match err {
95            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
96            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
97                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
98                source: err.into(),
99            }),
100        }
101    }
102}
103impl From<crate::operation::list_common_controls::ListCommonControlsError> for Error {
104    fn from(err: crate::operation::list_common_controls::ListCommonControlsError) -> Self {
105        match err {
106            crate::operation::list_common_controls::ListCommonControlsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
107            crate::operation::list_common_controls::ListCommonControlsError::InternalServerException(inner) => Error::InternalServerException(inner),
108            crate::operation::list_common_controls::ListCommonControlsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
109            crate::operation::list_common_controls::ListCommonControlsError::ValidationException(inner) => Error::ValidationException(inner),
110            crate::operation::list_common_controls::ListCommonControlsError::Unhandled(inner) => Error::Unhandled(inner),
111        }
112    }
113}
114impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_control_mappings::ListControlMappingsError, R>> for Error
115where
116    R: Send + Sync + std::fmt::Debug + 'static,
117{
118    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_control_mappings::ListControlMappingsError, R>) -> Self {
119        match err {
120            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
121            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
122                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
123                source: err.into(),
124            }),
125        }
126    }
127}
128impl From<crate::operation::list_control_mappings::ListControlMappingsError> for Error {
129    fn from(err: crate::operation::list_control_mappings::ListControlMappingsError) -> Self {
130        match err {
131            crate::operation::list_control_mappings::ListControlMappingsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
132            crate::operation::list_control_mappings::ListControlMappingsError::InternalServerException(inner) => {
133                Error::InternalServerException(inner)
134            }
135            crate::operation::list_control_mappings::ListControlMappingsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
136            crate::operation::list_control_mappings::ListControlMappingsError::ValidationException(inner) => Error::ValidationException(inner),
137            crate::operation::list_control_mappings::ListControlMappingsError::Unhandled(inner) => Error::Unhandled(inner),
138        }
139    }
140}
141impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_controls::ListControlsError, R>> for Error
142where
143    R: Send + Sync + std::fmt::Debug + 'static,
144{
145    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_controls::ListControlsError, R>) -> Self {
146        match err {
147            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
148            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
149                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
150                source: err.into(),
151            }),
152        }
153    }
154}
155impl From<crate::operation::list_controls::ListControlsError> for Error {
156    fn from(err: crate::operation::list_controls::ListControlsError) -> Self {
157        match err {
158            crate::operation::list_controls::ListControlsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
159            crate::operation::list_controls::ListControlsError::InternalServerException(inner) => Error::InternalServerException(inner),
160            crate::operation::list_controls::ListControlsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
161            crate::operation::list_controls::ListControlsError::ValidationException(inner) => Error::ValidationException(inner),
162            crate::operation::list_controls::ListControlsError::Unhandled(inner) => Error::Unhandled(inner),
163        }
164    }
165}
166impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_domains::ListDomainsError, R>> for Error
167where
168    R: Send + Sync + std::fmt::Debug + 'static,
169{
170    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_domains::ListDomainsError, R>) -> Self {
171        match err {
172            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
173            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
174                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
175                source: err.into(),
176            }),
177        }
178    }
179}
180impl From<crate::operation::list_domains::ListDomainsError> for Error {
181    fn from(err: crate::operation::list_domains::ListDomainsError) -> Self {
182        match err {
183            crate::operation::list_domains::ListDomainsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
184            crate::operation::list_domains::ListDomainsError::InternalServerException(inner) => Error::InternalServerException(inner),
185            crate::operation::list_domains::ListDomainsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
186            crate::operation::list_domains::ListDomainsError::ValidationException(inner) => Error::ValidationException(inner),
187            crate::operation::list_domains::ListDomainsError::Unhandled(inner) => Error::Unhandled(inner),
188        }
189    }
190}
191impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_objectives::ListObjectivesError, R>> for Error
192where
193    R: Send + Sync + std::fmt::Debug + 'static,
194{
195    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_objectives::ListObjectivesError, R>) -> Self {
196        match err {
197            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
198            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
199                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
200                source: err.into(),
201            }),
202        }
203    }
204}
205impl From<crate::operation::list_objectives::ListObjectivesError> for Error {
206    fn from(err: crate::operation::list_objectives::ListObjectivesError) -> Self {
207        match err {
208            crate::operation::list_objectives::ListObjectivesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
209            crate::operation::list_objectives::ListObjectivesError::InternalServerException(inner) => Error::InternalServerException(inner),
210            crate::operation::list_objectives::ListObjectivesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
211            crate::operation::list_objectives::ListObjectivesError::ValidationException(inner) => Error::ValidationException(inner),
212            crate::operation::list_objectives::ListObjectivesError::Unhandled(inner) => Error::Unhandled(inner),
213        }
214    }
215}
216impl ::std::error::Error for Error {
217    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
218        match self {
219            Error::AccessDeniedException(inner) => inner.source(),
220            Error::InternalServerException(inner) => inner.source(),
221            Error::ResourceNotFoundException(inner) => inner.source(),
222            Error::ThrottlingException(inner) => inner.source(),
223            Error::ValidationException(inner) => inner.source(),
224            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
225        }
226    }
227}
228impl ::aws_types::request_id::RequestId for Error {
229    fn request_id(&self) -> Option<&str> {
230        match self {
231            Self::AccessDeniedException(e) => e.request_id(),
232            Self::InternalServerException(e) => e.request_id(),
233            Self::ResourceNotFoundException(e) => e.request_id(),
234            Self::ThrottlingException(e) => e.request_id(),
235            Self::ValidationException(e) => e.request_id(),
236            Self::Unhandled(e) => e.meta.request_id(),
237        }
238    }
239}