aws_sdk_appconfigdata/
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>The input fails to satisfy the constraints specified by the service.</p>
7    BadRequestException(crate::types::error::BadRequestException),
8    /// <p>There was an internal failure in the service.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>The requested resource could not be found.</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    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
15    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16    variable wildcard pattern and check `.code()`:
17     \
18    &nbsp;&nbsp;&nbsp;`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::BadRequestException(inner) => inner.fmt(f),
27            Error::InternalServerException(inner) => inner.fmt(f),
28            Error::ResourceNotFoundException(inner) => inner.fmt(f),
29            Error::ThrottlingException(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::BadRequestException(inner) => inner.meta(),
52            Self::InternalServerException(inner) => inner.meta(),
53            Self::ResourceNotFoundException(inner) => inner.meta(),
54            Self::ThrottlingException(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_latest_configuration::GetLatestConfigurationError, R>> for Error
60where
61    R: Send + Sync + std::fmt::Debug + 'static,
62{
63    fn from(
64        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_latest_configuration::GetLatestConfigurationError, R>,
65    ) -> Self {
66        match err {
67            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
68            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
69                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
70                source: err.into(),
71            }),
72        }
73    }
74}
75impl From<crate::operation::get_latest_configuration::GetLatestConfigurationError> for Error {
76    fn from(err: crate::operation::get_latest_configuration::GetLatestConfigurationError) -> Self {
77        match err {
78            crate::operation::get_latest_configuration::GetLatestConfigurationError::BadRequestException(inner) => Error::BadRequestException(inner),
79            crate::operation::get_latest_configuration::GetLatestConfigurationError::InternalServerException(inner) => {
80                Error::InternalServerException(inner)
81            }
82            crate::operation::get_latest_configuration::GetLatestConfigurationError::ResourceNotFoundException(inner) => {
83                Error::ResourceNotFoundException(inner)
84            }
85            crate::operation::get_latest_configuration::GetLatestConfigurationError::ThrottlingException(inner) => Error::ThrottlingException(inner),
86            crate::operation::get_latest_configuration::GetLatestConfigurationError::Unhandled(inner) => Error::Unhandled(inner),
87        }
88    }
89}
90impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_configuration_session::StartConfigurationSessionError, R>>
91    for Error
92where
93    R: Send + Sync + std::fmt::Debug + 'static,
94{
95    fn from(
96        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_configuration_session::StartConfigurationSessionError, R>,
97    ) -> Self {
98        match err {
99            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
100            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
101                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
102                source: err.into(),
103            }),
104        }
105    }
106}
107impl From<crate::operation::start_configuration_session::StartConfigurationSessionError> for Error {
108    fn from(err: crate::operation::start_configuration_session::StartConfigurationSessionError) -> Self {
109        match err {
110            crate::operation::start_configuration_session::StartConfigurationSessionError::BadRequestException(inner) => {
111                Error::BadRequestException(inner)
112            }
113            crate::operation::start_configuration_session::StartConfigurationSessionError::InternalServerException(inner) => {
114                Error::InternalServerException(inner)
115            }
116            crate::operation::start_configuration_session::StartConfigurationSessionError::ResourceNotFoundException(inner) => {
117                Error::ResourceNotFoundException(inner)
118            }
119            crate::operation::start_configuration_session::StartConfigurationSessionError::ThrottlingException(inner) => {
120                Error::ThrottlingException(inner)
121            }
122            crate::operation::start_configuration_session::StartConfigurationSessionError::Unhandled(inner) => Error::Unhandled(inner),
123        }
124    }
125}
126impl ::std::error::Error for Error {
127    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
128        match self {
129            Error::BadRequestException(inner) => inner.source(),
130            Error::InternalServerException(inner) => inner.source(),
131            Error::ResourceNotFoundException(inner) => inner.source(),
132            Error::ThrottlingException(inner) => inner.source(),
133            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
134        }
135    }
136}
137impl ::aws_types::request_id::RequestId for Error {
138    fn request_id(&self) -> Option<&str> {
139        match self {
140            Self::BadRequestException(e) => e.request_id(),
141            Self::InternalServerException(e) => e.request_id(),
142            Self::ResourceNotFoundException(e) => e.request_id(),
143            Self::ThrottlingException(e) => e.request_id(),
144            Self::Unhandled(e) => e.meta.request_id(),
145        }
146    }
147}