aws_sdk_geomaps/
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 request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The request processing has failed because of an unknown error, exception or failure.</p>
9    InternalServerException(crate::types::error::InternalServerException),
10    /// <p>The request was denied due to request throttling.</p>
11    ThrottlingException(crate::types::error::ThrottlingException),
12    /// <p>The input fails to satisfy the constraints specified by an AWS service.</p>
13    ValidationException(crate::types::error::ValidationException),
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::AccessDeniedException(inner) => inner.fmt(f),
27            Error::InternalServerException(inner) => inner.fmt(f),
28            Error::ThrottlingException(inner) => inner.fmt(f),
29            Error::ValidationException(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::AccessDeniedException(inner) => inner.meta(),
52            Self::InternalServerException(inner) => inner.meta(),
53            Self::ThrottlingException(inner) => inner.meta(),
54            Self::ValidationException(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_glyphs::GetGlyphsError, R>> for Error
60where
61    R: Send + Sync + std::fmt::Debug + 'static,
62{
63    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_glyphs::GetGlyphsError, R>) -> Self {
64        match err {
65            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
66            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
67                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
68                source: err.into(),
69            }),
70        }
71    }
72}
73impl From<crate::operation::get_glyphs::GetGlyphsError> for Error {
74    fn from(err: crate::operation::get_glyphs::GetGlyphsError) -> Self {
75        match err {
76            crate::operation::get_glyphs::GetGlyphsError::Unhandled(inner) => Error::Unhandled(inner),
77        }
78    }
79}
80impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_sprites::GetSpritesError, R>> for Error
81where
82    R: Send + Sync + std::fmt::Debug + 'static,
83{
84    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_sprites::GetSpritesError, R>) -> Self {
85        match err {
86            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
87            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
88                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
89                source: err.into(),
90            }),
91        }
92    }
93}
94impl From<crate::operation::get_sprites::GetSpritesError> for Error {
95    fn from(err: crate::operation::get_sprites::GetSpritesError) -> Self {
96        match err {
97            crate::operation::get_sprites::GetSpritesError::Unhandled(inner) => Error::Unhandled(inner),
98        }
99    }
100}
101impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_static_map::GetStaticMapError, R>> for Error
102where
103    R: Send + Sync + std::fmt::Debug + 'static,
104{
105    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_static_map::GetStaticMapError, R>) -> Self {
106        match err {
107            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
108            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
109                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
110                source: err.into(),
111            }),
112        }
113    }
114}
115impl From<crate::operation::get_static_map::GetStaticMapError> for Error {
116    fn from(err: crate::operation::get_static_map::GetStaticMapError) -> Self {
117        match err {
118            crate::operation::get_static_map::GetStaticMapError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
119            crate::operation::get_static_map::GetStaticMapError::InternalServerException(inner) => Error::InternalServerException(inner),
120            crate::operation::get_static_map::GetStaticMapError::ThrottlingException(inner) => Error::ThrottlingException(inner),
121            crate::operation::get_static_map::GetStaticMapError::ValidationException(inner) => Error::ValidationException(inner),
122            crate::operation::get_static_map::GetStaticMapError::Unhandled(inner) => Error::Unhandled(inner),
123        }
124    }
125}
126impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_style_descriptor::GetStyleDescriptorError, 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::get_style_descriptor::GetStyleDescriptorError, 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::get_style_descriptor::GetStyleDescriptorError> for Error {
141    fn from(err: crate::operation::get_style_descriptor::GetStyleDescriptorError) -> Self {
142        match err {
143            crate::operation::get_style_descriptor::GetStyleDescriptorError::Unhandled(inner) => Error::Unhandled(inner),
144        }
145    }
146}
147impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_tile::GetTileError, R>> for Error
148where
149    R: Send + Sync + std::fmt::Debug + 'static,
150{
151    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_tile::GetTileError, R>) -> Self {
152        match err {
153            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
154            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
155                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
156                source: err.into(),
157            }),
158        }
159    }
160}
161impl From<crate::operation::get_tile::GetTileError> for Error {
162    fn from(err: crate::operation::get_tile::GetTileError) -> Self {
163        match err {
164            crate::operation::get_tile::GetTileError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
165            crate::operation::get_tile::GetTileError::InternalServerException(inner) => Error::InternalServerException(inner),
166            crate::operation::get_tile::GetTileError::ThrottlingException(inner) => Error::ThrottlingException(inner),
167            crate::operation::get_tile::GetTileError::ValidationException(inner) => Error::ValidationException(inner),
168            crate::operation::get_tile::GetTileError::Unhandled(inner) => Error::Unhandled(inner),
169        }
170    }
171}
172impl ::std::error::Error for Error {
173    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
174        match self {
175            Error::AccessDeniedException(inner) => inner.source(),
176            Error::InternalServerException(inner) => inner.source(),
177            Error::ThrottlingException(inner) => inner.source(),
178            Error::ValidationException(inner) => inner.source(),
179            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
180        }
181    }
182}
183impl ::aws_types::request_id::RequestId for Error {
184    fn request_id(&self) -> Option<&str> {
185        match self {
186            Self::AccessDeniedException(e) => e.request_id(),
187            Self::InternalServerException(e) => e.request_id(),
188            Self::ThrottlingException(e) => e.request_id(),
189            Self::ValidationException(e) => e.request_id(),
190            Self::Unhandled(e) => e.meta.request_id(),
191        }
192    }
193}