aws_sdk_migrationhubconfig/
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>Exception raised to indicate that authorization of an action was successful, when the <code>DryRun</code> flag is set to true.</p>
9    DryRunOperation(crate::types::error::DryRunOperation),
10    /// <p>Exception raised when an internal, configuration, or dependency error is encountered.</p>
11    InternalServerError(crate::types::error::InternalServerError),
12    /// <p>Exception raised when the provided input violates a policy constraint or is entered in the wrong format or data type.</p>
13    InvalidInputException(crate::types::error::InvalidInputException),
14    /// <p>Exception raised when a request fails due to temporary unavailability of the service.</p>
15    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
16    /// <p>The request was denied due to request throttling.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
19    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20    variable wildcard pattern and check `.code()`:
21     \
22    &nbsp;&nbsp;&nbsp;`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::AccessDeniedException(inner) => inner.fmt(f),
31            Error::DryRunOperation(inner) => inner.fmt(f),
32            Error::InternalServerError(inner) => inner.fmt(f),
33            Error::InvalidInputException(inner) => inner.fmt(f),
34            Error::ServiceUnavailableException(inner) => inner.fmt(f),
35            Error::ThrottlingException(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::AccessDeniedException(inner) => inner.meta(),
58            Self::DryRunOperation(inner) => inner.meta(),
59            Self::InternalServerError(inner) => inner.meta(),
60            Self::InvalidInputException(inner) => inner.meta(),
61            Self::ServiceUnavailableException(inner) => inner.meta(),
62            Self::ThrottlingException(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_home_region_control::CreateHomeRegionControlError, R>>
68    for Error
69where
70    R: Send + Sync + std::fmt::Debug + 'static,
71{
72    fn from(
73        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_home_region_control::CreateHomeRegionControlError, R>,
74    ) -> Self {
75        match err {
76            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
77            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
78                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
79                source: err.into(),
80            }),
81        }
82    }
83}
84impl From<crate::operation::create_home_region_control::CreateHomeRegionControlError> for Error {
85    fn from(err: crate::operation::create_home_region_control::CreateHomeRegionControlError) -> Self {
86        match err {
87            crate::operation::create_home_region_control::CreateHomeRegionControlError::AccessDeniedException(inner) => {
88                Error::AccessDeniedException(inner)
89            }
90            crate::operation::create_home_region_control::CreateHomeRegionControlError::DryRunOperation(inner) => Error::DryRunOperation(inner),
91            crate::operation::create_home_region_control::CreateHomeRegionControlError::InternalServerError(inner) => {
92                Error::InternalServerError(inner)
93            }
94            crate::operation::create_home_region_control::CreateHomeRegionControlError::InvalidInputException(inner) => {
95                Error::InvalidInputException(inner)
96            }
97            crate::operation::create_home_region_control::CreateHomeRegionControlError::ServiceUnavailableException(inner) => {
98                Error::ServiceUnavailableException(inner)
99            }
100            crate::operation::create_home_region_control::CreateHomeRegionControlError::ThrottlingException(inner) => {
101                Error::ThrottlingException(inner)
102            }
103            crate::operation::create_home_region_control::CreateHomeRegionControlError::Unhandled(inner) => Error::Unhandled(inner),
104        }
105    }
106}
107impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_home_region_control::DeleteHomeRegionControlError, R>>
108    for Error
109where
110    R: Send + Sync + std::fmt::Debug + 'static,
111{
112    fn from(
113        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_home_region_control::DeleteHomeRegionControlError, R>,
114    ) -> Self {
115        match err {
116            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
117            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
118                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
119                source: err.into(),
120            }),
121        }
122    }
123}
124impl From<crate::operation::delete_home_region_control::DeleteHomeRegionControlError> for Error {
125    fn from(err: crate::operation::delete_home_region_control::DeleteHomeRegionControlError) -> Self {
126        match err {
127            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::AccessDeniedException(inner) => {
128                Error::AccessDeniedException(inner)
129            }
130            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::InternalServerError(inner) => {
131                Error::InternalServerError(inner)
132            }
133            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::InvalidInputException(inner) => {
134                Error::InvalidInputException(inner)
135            }
136            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::ServiceUnavailableException(inner) => {
137                Error::ServiceUnavailableException(inner)
138            }
139            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::ThrottlingException(inner) => {
140                Error::ThrottlingException(inner)
141            }
142            crate::operation::delete_home_region_control::DeleteHomeRegionControlError::Unhandled(inner) => Error::Unhandled(inner),
143        }
144    }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError, R>>
147    for Error
148where
149    R: Send + Sync + std::fmt::Debug + 'static,
150{
151    fn from(
152        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError, R>,
153    ) -> Self {
154        match err {
155            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
156            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
157                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
158                source: err.into(),
159            }),
160        }
161    }
162}
163impl From<crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError> for Error {
164    fn from(err: crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError) -> Self {
165        match err {
166            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::AccessDeniedException(inner) => {
167                Error::AccessDeniedException(inner)
168            }
169            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::InternalServerError(inner) => {
170                Error::InternalServerError(inner)
171            }
172            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::InvalidInputException(inner) => {
173                Error::InvalidInputException(inner)
174            }
175            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::ServiceUnavailableException(inner) => {
176                Error::ServiceUnavailableException(inner)
177            }
178            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::ThrottlingException(inner) => {
179                Error::ThrottlingException(inner)
180            }
181            crate::operation::describe_home_region_controls::DescribeHomeRegionControlsError::Unhandled(inner) => Error::Unhandled(inner),
182        }
183    }
184}
185impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_home_region::GetHomeRegionError, R>> for Error
186where
187    R: Send + Sync + std::fmt::Debug + 'static,
188{
189    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_home_region::GetHomeRegionError, R>) -> Self {
190        match err {
191            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
192            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
193                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
194                source: err.into(),
195            }),
196        }
197    }
198}
199impl From<crate::operation::get_home_region::GetHomeRegionError> for Error {
200    fn from(err: crate::operation::get_home_region::GetHomeRegionError) -> Self {
201        match err {
202            crate::operation::get_home_region::GetHomeRegionError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
203            crate::operation::get_home_region::GetHomeRegionError::InternalServerError(inner) => Error::InternalServerError(inner),
204            crate::operation::get_home_region::GetHomeRegionError::InvalidInputException(inner) => Error::InvalidInputException(inner),
205            crate::operation::get_home_region::GetHomeRegionError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
206            crate::operation::get_home_region::GetHomeRegionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
207            crate::operation::get_home_region::GetHomeRegionError::Unhandled(inner) => Error::Unhandled(inner),
208        }
209    }
210}
211impl ::std::error::Error for Error {
212    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
213        match self {
214            Error::AccessDeniedException(inner) => inner.source(),
215            Error::DryRunOperation(inner) => inner.source(),
216            Error::InternalServerError(inner) => inner.source(),
217            Error::InvalidInputException(inner) => inner.source(),
218            Error::ServiceUnavailableException(inner) => inner.source(),
219            Error::ThrottlingException(inner) => inner.source(),
220            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
221        }
222    }
223}
224impl ::aws_types::request_id::RequestId for Error {
225    fn request_id(&self) -> Option<&str> {
226        match self {
227            Self::AccessDeniedException(e) => e.request_id(),
228            Self::DryRunOperation(e) => e.request_id(),
229            Self::InternalServerError(e) => e.request_id(),
230            Self::InvalidInputException(e) => e.request_id(),
231            Self::ServiceUnavailableException(e) => e.request_id(),
232            Self::ThrottlingException(e) => e.request_id(),
233            Self::Unhandled(e) => e.meta.request_id(),
234        }
235    }
236}