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>Exception thrown when the associated 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    /// <p>The input fails to satisfy the constraints specified by an AWS service.</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_glyphs::GetGlyphsError, 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_glyphs::GetGlyphsError, 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_glyphs::GetGlyphsError> for Error {
78    fn from(err: crate::operation::get_glyphs::GetGlyphsError) -> Self {
79        match err {
80            crate::operation::get_glyphs::GetGlyphsError::Unhandled(inner) => Error::Unhandled(inner),
81        }
82    }
83}
84impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_sprites::GetSpritesError, R>> for Error
85where
86    R: Send + Sync + std::fmt::Debug + 'static,
87{
88    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_sprites::GetSpritesError, R>) -> Self {
89        match err {
90            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
91            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
92                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
93                source: err.into(),
94            }),
95        }
96    }
97}
98impl From<crate::operation::get_sprites::GetSpritesError> for Error {
99    fn from(err: crate::operation::get_sprites::GetSpritesError) -> Self {
100        match err {
101            crate::operation::get_sprites::GetSpritesError::Unhandled(inner) => Error::Unhandled(inner),
102        }
103    }
104}
105impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_static_map::GetStaticMapError, R>> for Error
106where
107    R: Send + Sync + std::fmt::Debug + 'static,
108{
109    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_static_map::GetStaticMapError, R>) -> 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::get_static_map::GetStaticMapError> for Error {
120    fn from(err: crate::operation::get_static_map::GetStaticMapError) -> Self {
121        match err {
122            crate::operation::get_static_map::GetStaticMapError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
123            crate::operation::get_static_map::GetStaticMapError::InternalServerException(inner) => Error::InternalServerException(inner),
124            crate::operation::get_static_map::GetStaticMapError::ThrottlingException(inner) => Error::ThrottlingException(inner),
125            crate::operation::get_static_map::GetStaticMapError::ValidationException(inner) => Error::ValidationException(inner),
126            crate::operation::get_static_map::GetStaticMapError::Unhandled(inner) => Error::Unhandled(inner),
127        }
128    }
129}
130impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_style_descriptor::GetStyleDescriptorError, R>> for Error
131where
132    R: Send + Sync + std::fmt::Debug + 'static,
133{
134    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_style_descriptor::GetStyleDescriptorError, R>) -> Self {
135        match err {
136            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
137            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
138                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
139                source: err.into(),
140            }),
141        }
142    }
143}
144impl From<crate::operation::get_style_descriptor::GetStyleDescriptorError> for Error {
145    fn from(err: crate::operation::get_style_descriptor::GetStyleDescriptorError) -> Self {
146        match err {
147            crate::operation::get_style_descriptor::GetStyleDescriptorError::Unhandled(inner) => Error::Unhandled(inner),
148        }
149    }
150}
151impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_tile::GetTileError, R>> for Error
152where
153    R: Send + Sync + std::fmt::Debug + 'static,
154{
155    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_tile::GetTileError, R>) -> Self {
156        match err {
157            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
158            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
159                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
160                source: err.into(),
161            }),
162        }
163    }
164}
165impl From<crate::operation::get_tile::GetTileError> for Error {
166    fn from(err: crate::operation::get_tile::GetTileError) -> Self {
167        match err {
168            crate::operation::get_tile::GetTileError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
169            crate::operation::get_tile::GetTileError::InternalServerException(inner) => Error::InternalServerException(inner),
170            crate::operation::get_tile::GetTileError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
171            crate::operation::get_tile::GetTileError::ThrottlingException(inner) => Error::ThrottlingException(inner),
172            crate::operation::get_tile::GetTileError::ValidationException(inner) => Error::ValidationException(inner),
173            crate::operation::get_tile::GetTileError::Unhandled(inner) => Error::Unhandled(inner),
174        }
175    }
176}
177impl ::std::error::Error for Error {
178    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
179        match self {
180            Error::AccessDeniedException(inner) => inner.source(),
181            Error::InternalServerException(inner) => inner.source(),
182            Error::ResourceNotFoundException(inner) => inner.source(),
183            Error::ThrottlingException(inner) => inner.source(),
184            Error::ValidationException(inner) => inner.source(),
185            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
186        }
187    }
188}
189impl ::aws_types::request_id::RequestId for Error {
190    fn request_id(&self) -> Option<&str> {
191        match self {
192            Self::AccessDeniedException(e) => e.request_id(),
193            Self::InternalServerException(e) => e.request_id(),
194            Self::ResourceNotFoundException(e) => e.request_id(),
195            Self::ThrottlingException(e) => e.request_id(),
196            Self::ValidationException(e) => e.request_id(),
197            Self::Unhandled(e) => e.meta.request_id(),
198        }
199    }
200}