aws_sdk_keyspacesstreams/
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 don't have sufficient access permissions to perform this operation.</p>
7    /// <p>This exception occurs when your IAM user or role lacks the required permissions to access the Amazon Keyspaces resource or perform the requested action. Check your IAM policies and ensure they grant the necessary permissions.</p>
8    AccessDeniedException(crate::types::error::AccessDeniedException),
9    /// <p>The Amazon Keyspaces service encountered an unexpected error while processing the request.</p>
10    /// <p>This internal server error is not related to your request parameters. Retry your request after a brief delay. If the issue persists, contact Amazon Web Services Support with details of your request to help identify and resolve the problem.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The requested resource doesn't exist or could not be found.</p>
13    /// <p>This exception occurs when you attempt to access a keyspace, table, stream, or other Amazon Keyspaces resource that doesn't exist or that has been deleted. Verify that the resource identifier is correct and that the resource exists in your account.</p>
14    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
15    /// <p>The request rate is too high and exceeds the service's throughput limits.</p>
16    /// <p>This exception occurs when you send too many requests in a short period of time. Implement exponential backoff in your retry strategy to handle this exception. Reducing your request frequency or distributing requests more evenly can help avoid throughput exceptions.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// <p>The request validation failed because one or more input parameters failed validation.</p>
19    /// <p>This exception occurs when there are syntax errors in the request, field constraints are violated, or required parameters are missing. To help you fix the issue, the exception message provides details about which parameter failed and why.</p>
20    ValidationException(crate::types::error::ValidationException),
21    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
22    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
23    variable wildcard pattern and check `.code()`:
24     \
25    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
26     \
27    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
28    Unhandled(crate::error::sealed_unhandled::Unhandled),
29}
30impl ::std::fmt::Display for Error {
31    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32        match self {
33            Error::AccessDeniedException(inner) => inner.fmt(f),
34            Error::InternalServerException(inner) => inner.fmt(f),
35            Error::ResourceNotFoundException(inner) => inner.fmt(f),
36            Error::ThrottlingException(inner) => inner.fmt(f),
37            Error::ValidationException(inner) => inner.fmt(f),
38            Error::Unhandled(_) => {
39                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
40                    write!(f, "unhandled error ({code})")
41                } else {
42                    f.write_str("unhandled error")
43                }
44            }
45        }
46    }
47}
48impl From<::aws_smithy_types::error::operation::BuildError> for Error {
49    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
50        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
51            source: value.into(),
52            meta: ::std::default::Default::default(),
53        })
54    }
55}
56impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
57    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
58        match self {
59            Self::AccessDeniedException(inner) => inner.meta(),
60            Self::InternalServerException(inner) => inner.meta(),
61            Self::ResourceNotFoundException(inner) => inner.meta(),
62            Self::ThrottlingException(inner) => inner.meta(),
63            Self::ValidationException(inner) => inner.meta(),
64            Self::Unhandled(inner) => &inner.meta,
65        }
66    }
67}
68impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>> for Error
69where
70    R: Send + Sync + std::fmt::Debug + 'static,
71{
72    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>) -> Self {
73        match err {
74            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
75            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
76                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
77                source: err.into(),
78            }),
79        }
80    }
81}
82impl From<crate::operation::get_records::GetRecordsError> for Error {
83    fn from(err: crate::operation::get_records::GetRecordsError) -> Self {
84        match err {
85            crate::operation::get_records::GetRecordsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
86            crate::operation::get_records::GetRecordsError::InternalServerException(inner) => Error::InternalServerException(inner),
87            crate::operation::get_records::GetRecordsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
88            crate::operation::get_records::GetRecordsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
89            crate::operation::get_records::GetRecordsError::ValidationException(inner) => Error::ValidationException(inner),
90            crate::operation::get_records::GetRecordsError::Unhandled(inner) => Error::Unhandled(inner),
91        }
92    }
93}
94impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>> for Error
95where
96    R: Send + Sync + std::fmt::Debug + 'static,
97{
98    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>) -> Self {
99        match err {
100            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
101            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
102                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
103                source: err.into(),
104            }),
105        }
106    }
107}
108impl From<crate::operation::get_shard_iterator::GetShardIteratorError> for Error {
109    fn from(err: crate::operation::get_shard_iterator::GetShardIteratorError) -> Self {
110        match err {
111            crate::operation::get_shard_iterator::GetShardIteratorError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
112            crate::operation::get_shard_iterator::GetShardIteratorError::InternalServerException(inner) => Error::InternalServerException(inner),
113            crate::operation::get_shard_iterator::GetShardIteratorError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
114            crate::operation::get_shard_iterator::GetShardIteratorError::ThrottlingException(inner) => Error::ThrottlingException(inner),
115            crate::operation::get_shard_iterator::GetShardIteratorError::ValidationException(inner) => Error::ValidationException(inner),
116            crate::operation::get_shard_iterator::GetShardIteratorError::Unhandled(inner) => Error::Unhandled(inner),
117        }
118    }
119}
120impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_stream::GetStreamError, R>> for Error
121where
122    R: Send + Sync + std::fmt::Debug + 'static,
123{
124    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_stream::GetStreamError, R>) -> Self {
125        match err {
126            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
127            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
128                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
129                source: err.into(),
130            }),
131        }
132    }
133}
134impl From<crate::operation::get_stream::GetStreamError> for Error {
135    fn from(err: crate::operation::get_stream::GetStreamError) -> Self {
136        match err {
137            crate::operation::get_stream::GetStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
138            crate::operation::get_stream::GetStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
139            crate::operation::get_stream::GetStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
140            crate::operation::get_stream::GetStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
141            crate::operation::get_stream::GetStreamError::ValidationException(inner) => Error::ValidationException(inner),
142            crate::operation::get_stream::GetStreamError::Unhandled(inner) => Error::Unhandled(inner),
143        }
144    }
145}
146impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_streams::ListStreamsError, R>> for Error
147where
148    R: Send + Sync + std::fmt::Debug + 'static,
149{
150    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_streams::ListStreamsError, R>) -> Self {
151        match err {
152            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
153            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
154                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
155                source: err.into(),
156            }),
157        }
158    }
159}
160impl From<crate::operation::list_streams::ListStreamsError> for Error {
161    fn from(err: crate::operation::list_streams::ListStreamsError) -> Self {
162        match err {
163            crate::operation::list_streams::ListStreamsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
164            crate::operation::list_streams::ListStreamsError::InternalServerException(inner) => Error::InternalServerException(inner),
165            crate::operation::list_streams::ListStreamsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
166            crate::operation::list_streams::ListStreamsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
167            crate::operation::list_streams::ListStreamsError::ValidationException(inner) => Error::ValidationException(inner),
168            crate::operation::list_streams::ListStreamsError::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::ResourceNotFoundException(inner) => inner.source(),
178            Error::ThrottlingException(inner) => inner.source(),
179            Error::ValidationException(inner) => inner.source(),
180            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
181        }
182    }
183}
184impl ::aws_types::request_id::RequestId for Error {
185    fn request_id(&self) -> Option<&str> {
186        match self {
187            Self::AccessDeniedException(e) => e.request_id(),
188            Self::InternalServerException(e) => e.request_id(),
189            Self::ResourceNotFoundException(e) => e.request_id(),
190            Self::ThrottlingException(e) => e.request_id(),
191            Self::ValidationException(e) => e.request_id(),
192            Self::Unhandled(e) => e.meta.request_id(),
193        }
194    }
195}