Skip to main content

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    /// <p>This exception can also occur when more than two processes are reading from the same stream shard at the same time. Ensure that only one process reads from a stream shard at the same time.</p>
18    ThrottlingException(crate::types::error::ThrottlingException),
19    /// <p>The request validation failed because one or more input parameters failed validation.</p>
20    /// <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>
21    ValidationException(crate::types::error::ValidationException),
22    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
23    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
24    variable wildcard pattern and check `.code()`:
25     \
26    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
27     \
28    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
29    Unhandled(crate::error::sealed_unhandled::Unhandled),
30}
31impl ::std::fmt::Display for Error {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        match self {
34            Error::AccessDeniedException(inner) => inner.fmt(f),
35            Error::InternalServerException(inner) => inner.fmt(f),
36            Error::ResourceNotFoundException(inner) => inner.fmt(f),
37            Error::ThrottlingException(inner) => inner.fmt(f),
38            Error::ValidationException(inner) => inner.fmt(f),
39            Error::Unhandled(_) => {
40                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
41                    write!(f, "unhandled error ({code})")
42                } else {
43                    f.write_str("unhandled error")
44                }
45            }
46        }
47    }
48}
49impl From<::aws_smithy_types::error::operation::BuildError> for Error {
50    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
51        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
52            source: value.into(),
53            meta: ::std::default::Default::default(),
54        })
55    }
56}
57impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
58    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
59        match self {
60            Self::AccessDeniedException(inner) => inner.meta(),
61            Self::InternalServerException(inner) => inner.meta(),
62            Self::ResourceNotFoundException(inner) => inner.meta(),
63            Self::ThrottlingException(inner) => inner.meta(),
64            Self::ValidationException(inner) => inner.meta(),
65            Self::Unhandled(inner) => &inner.meta,
66        }
67    }
68}
69impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>> for Error
70where
71    R: Send + Sync + std::fmt::Debug + 'static,
72{
73    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>) -> Self {
74        match err {
75            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
76            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
77                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
78                source: err.into(),
79            }),
80        }
81    }
82}
83impl From<crate::operation::get_records::GetRecordsError> for Error {
84    fn from(err: crate::operation::get_records::GetRecordsError) -> Self {
85        match err {
86            crate::operation::get_records::GetRecordsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
87            crate::operation::get_records::GetRecordsError::InternalServerException(inner) => Error::InternalServerException(inner),
88            crate::operation::get_records::GetRecordsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
89            crate::operation::get_records::GetRecordsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
90            crate::operation::get_records::GetRecordsError::ValidationException(inner) => Error::ValidationException(inner),
91            crate::operation::get_records::GetRecordsError::Unhandled(inner) => Error::Unhandled(inner),
92        }
93    }
94}
95impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>> for Error
96where
97    R: Send + Sync + std::fmt::Debug + 'static,
98{
99    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>) -> Self {
100        match err {
101            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
102            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
103                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
104                source: err.into(),
105            }),
106        }
107    }
108}
109impl From<crate::operation::get_shard_iterator::GetShardIteratorError> for Error {
110    fn from(err: crate::operation::get_shard_iterator::GetShardIteratorError) -> Self {
111        match err {
112            crate::operation::get_shard_iterator::GetShardIteratorError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
113            crate::operation::get_shard_iterator::GetShardIteratorError::InternalServerException(inner) => Error::InternalServerException(inner),
114            crate::operation::get_shard_iterator::GetShardIteratorError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
115            crate::operation::get_shard_iterator::GetShardIteratorError::ThrottlingException(inner) => Error::ThrottlingException(inner),
116            crate::operation::get_shard_iterator::GetShardIteratorError::ValidationException(inner) => Error::ValidationException(inner),
117            crate::operation::get_shard_iterator::GetShardIteratorError::Unhandled(inner) => Error::Unhandled(inner),
118        }
119    }
120}
121impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_stream::GetStreamError, R>> for Error
122where
123    R: Send + Sync + std::fmt::Debug + 'static,
124{
125    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_stream::GetStreamError, R>) -> Self {
126        match err {
127            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
128            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
129                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
130                source: err.into(),
131            }),
132        }
133    }
134}
135impl From<crate::operation::get_stream::GetStreamError> for Error {
136    fn from(err: crate::operation::get_stream::GetStreamError) -> Self {
137        match err {
138            crate::operation::get_stream::GetStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
139            crate::operation::get_stream::GetStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
140            crate::operation::get_stream::GetStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
141            crate::operation::get_stream::GetStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
142            crate::operation::get_stream::GetStreamError::ValidationException(inner) => Error::ValidationException(inner),
143            crate::operation::get_stream::GetStreamError::Unhandled(inner) => Error::Unhandled(inner),
144        }
145    }
146}
147impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_streams::ListStreamsError, 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::list_streams::ListStreamsError, 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::list_streams::ListStreamsError> for Error {
162    fn from(err: crate::operation::list_streams::ListStreamsError) -> Self {
163        match err {
164            crate::operation::list_streams::ListStreamsError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
165            crate::operation::list_streams::ListStreamsError::InternalServerException(inner) => Error::InternalServerException(inner),
166            crate::operation::list_streams::ListStreamsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
167            crate::operation::list_streams::ListStreamsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
168            crate::operation::list_streams::ListStreamsError::ValidationException(inner) => Error::ValidationException(inner),
169            crate::operation::list_streams::ListStreamsError::Unhandled(inner) => Error::Unhandled(inner),
170        }
171    }
172}
173impl ::std::error::Error for Error {
174    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
175        match self {
176            Error::AccessDeniedException(inner) => inner.source(),
177            Error::InternalServerException(inner) => inner.source(),
178            Error::ResourceNotFoundException(inner) => inner.source(),
179            Error::ThrottlingException(inner) => inner.source(),
180            Error::ValidationException(inner) => inner.source(),
181            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
182        }
183    }
184}
185impl ::aws_types::request_id::RequestId for Error {
186    fn request_id(&self) -> Option<&str> {
187        match self {
188            Self::AccessDeniedException(e) => e.request_id(),
189            Self::InternalServerException(e) => e.request_id(),
190            Self::ResourceNotFoundException(e) => e.request_id(),
191            Self::ThrottlingException(e) => e.request_id(),
192            Self::ValidationException(e) => e.request_id(),
193            Self::Unhandled(e) => e.meta.request_id(),
194        }
195    }
196}