aws_sdk_sagemakerfeaturestoreruntime/
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 permission to perform an action.</p>
7    AccessForbidden(crate::types::error::AccessForbidden),
8    /// <p>An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.</p>
9    InternalFailure(crate::types::error::InternalFailure),
10    /// <p>A resource that is required to perform an action was not found.</p>
11    ResourceNotFound(crate::types::error::ResourceNotFound),
12    /// <p>The service is currently unavailable.</p>
13    ServiceUnavailable(crate::types::error::ServiceUnavailable),
14    /// <p>There was an error validating your request.</p>
15    ValidationError(crate::types::error::ValidationError),
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::AccessForbidden(inner) => inner.fmt(f),
29            Error::InternalFailure(inner) => inner.fmt(f),
30            Error::ResourceNotFound(inner) => inner.fmt(f),
31            Error::ServiceUnavailable(inner) => inner.fmt(f),
32            Error::ValidationError(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::AccessForbidden(inner) => inner.meta(),
55            Self::InternalFailure(inner) => inner.meta(),
56            Self::ResourceNotFound(inner) => inner.meta(),
57            Self::ServiceUnavailable(inner) => inner.meta(),
58            Self::ValidationError(inner) => inner.meta(),
59            Self::Unhandled(inner) => &inner.meta,
60        }
61    }
62}
63impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::batch_get_record::BatchGetRecordError, 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::batch_get_record::BatchGetRecordError, 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::batch_get_record::BatchGetRecordError> for Error {
78    fn from(err: crate::operation::batch_get_record::BatchGetRecordError) -> Self {
79        match err {
80            crate::operation::batch_get_record::BatchGetRecordError::AccessForbidden(inner) => Error::AccessForbidden(inner),
81            crate::operation::batch_get_record::BatchGetRecordError::InternalFailure(inner) => Error::InternalFailure(inner),
82            crate::operation::batch_get_record::BatchGetRecordError::ServiceUnavailable(inner) => Error::ServiceUnavailable(inner),
83            crate::operation::batch_get_record::BatchGetRecordError::ValidationError(inner) => Error::ValidationError(inner),
84            crate::operation::batch_get_record::BatchGetRecordError::Unhandled(inner) => Error::Unhandled(inner),
85        }
86    }
87}
88impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_record::DeleteRecordError, R>> for Error
89where
90    R: Send + Sync + std::fmt::Debug + 'static,
91{
92    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_record::DeleteRecordError, R>) -> Self {
93        match err {
94            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
95            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
96                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
97                source: err.into(),
98            }),
99        }
100    }
101}
102impl From<crate::operation::delete_record::DeleteRecordError> for Error {
103    fn from(err: crate::operation::delete_record::DeleteRecordError) -> Self {
104        match err {
105            crate::operation::delete_record::DeleteRecordError::AccessForbidden(inner) => Error::AccessForbidden(inner),
106            crate::operation::delete_record::DeleteRecordError::InternalFailure(inner) => Error::InternalFailure(inner),
107            crate::operation::delete_record::DeleteRecordError::ServiceUnavailable(inner) => Error::ServiceUnavailable(inner),
108            crate::operation::delete_record::DeleteRecordError::ValidationError(inner) => Error::ValidationError(inner),
109            crate::operation::delete_record::DeleteRecordError::Unhandled(inner) => Error::Unhandled(inner),
110        }
111    }
112}
113impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_record::GetRecordError, R>> for Error
114where
115    R: Send + Sync + std::fmt::Debug + 'static,
116{
117    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_record::GetRecordError, R>) -> Self {
118        match err {
119            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
120            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
121                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
122                source: err.into(),
123            }),
124        }
125    }
126}
127impl From<crate::operation::get_record::GetRecordError> for Error {
128    fn from(err: crate::operation::get_record::GetRecordError) -> Self {
129        match err {
130            crate::operation::get_record::GetRecordError::AccessForbidden(inner) => Error::AccessForbidden(inner),
131            crate::operation::get_record::GetRecordError::InternalFailure(inner) => Error::InternalFailure(inner),
132            crate::operation::get_record::GetRecordError::ResourceNotFound(inner) => Error::ResourceNotFound(inner),
133            crate::operation::get_record::GetRecordError::ServiceUnavailable(inner) => Error::ServiceUnavailable(inner),
134            crate::operation::get_record::GetRecordError::ValidationError(inner) => Error::ValidationError(inner),
135            crate::operation::get_record::GetRecordError::Unhandled(inner) => Error::Unhandled(inner),
136        }
137    }
138}
139impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_record::PutRecordError, R>> for Error
140where
141    R: Send + Sync + std::fmt::Debug + 'static,
142{
143    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_record::PutRecordError, R>) -> Self {
144        match err {
145            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
146            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
147                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
148                source: err.into(),
149            }),
150        }
151    }
152}
153impl From<crate::operation::put_record::PutRecordError> for Error {
154    fn from(err: crate::operation::put_record::PutRecordError) -> Self {
155        match err {
156            crate::operation::put_record::PutRecordError::AccessForbidden(inner) => Error::AccessForbidden(inner),
157            crate::operation::put_record::PutRecordError::InternalFailure(inner) => Error::InternalFailure(inner),
158            crate::operation::put_record::PutRecordError::ServiceUnavailable(inner) => Error::ServiceUnavailable(inner),
159            crate::operation::put_record::PutRecordError::ValidationError(inner) => Error::ValidationError(inner),
160            crate::operation::put_record::PutRecordError::Unhandled(inner) => Error::Unhandled(inner),
161        }
162    }
163}
164impl ::std::error::Error for Error {
165    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
166        match self {
167            Error::AccessForbidden(inner) => inner.source(),
168            Error::InternalFailure(inner) => inner.source(),
169            Error::ResourceNotFound(inner) => inner.source(),
170            Error::ServiceUnavailable(inner) => inner.source(),
171            Error::ValidationError(inner) => inner.source(),
172            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
173        }
174    }
175}
176impl ::aws_types::request_id::RequestId for Error {
177    fn request_id(&self) -> Option<&str> {
178        match self {
179            Self::AccessForbidden(e) => e.request_id(),
180            Self::InternalFailure(e) => e.request_id(),
181            Self::ResourceNotFound(e) => e.request_id(),
182            Self::ServiceUnavailable(e) => e.request_id(),
183            Self::ValidationError(e) => e.request_id(),
184            Self::Unhandled(e) => e.meta.request_id(),
185        }
186    }
187}