aws_sdk_dynamodbstreams/
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 shard iterator has expired and can no longer be used to retrieve stream records. A shard iterator expires 15 minutes after it is retrieved using the <code>GetShardIterator</code> action.</p>
7    ExpiredIteratorException(crate::types::error::ExpiredIteratorException),
8    /// <p>An error occurred on the server side.</p>
9    InternalServerError(crate::types::error::InternalServerError),
10    /// <p>There is no limit to the number of daily on-demand backups that can be taken.</p>
11    /// <p>For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include <code>CreateTable</code>, <code>UpdateTable</code>, <code>DeleteTable</code>,<code>UpdateTimeToLive</code>, <code>RestoreTableFromBackup</code>, and <code>RestoreTableToPointInTime</code>.</p>
12    /// <p>When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations.</p>
13    /// <p>When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.</p>
14    /// <p>There is a soft account quota of 2,500 tables.</p>
15    /// <p>GetRecords was called with a value of more than 1000 for the limit request parameter.</p>
16    /// <p>More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling.</p>
17    LimitExceededException(crate::types::error::LimitExceededException),
18    /// <p>The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be <code>ACTIVE</code>.</p>
19    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
20    /// <p>The operation attempted to read past the oldest stream record in a shard.</p>
21    /// <p>In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream. You might receive a TrimmedDataAccessException if:</p>
22    /// <ul>
23    /// <li>
24    /// <p>You request a shard iterator with a sequence number older than the trim point (24 hours).</p></li>
25    /// <li>
26    /// <p>You obtain a shard iterator, but before you use the iterator in a <code>GetRecords</code> request, a stream record in the shard exceeds the 24 hour period and is trimmed. This causes the iterator to access a record that no longer exists.</p></li>
27    /// </ul>
28    TrimmedDataAccessException(crate::types::error::TrimmedDataAccessException),
29    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
30    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
31    variable wildcard pattern and check `.code()`:
32     \
33    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
34     \
35    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
36    Unhandled(crate::error::sealed_unhandled::Unhandled),
37}
38impl ::std::fmt::Display for Error {
39    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40        match self {
41            Error::ExpiredIteratorException(inner) => inner.fmt(f),
42            Error::InternalServerError(inner) => inner.fmt(f),
43            Error::LimitExceededException(inner) => inner.fmt(f),
44            Error::ResourceNotFoundException(inner) => inner.fmt(f),
45            Error::TrimmedDataAccessException(inner) => inner.fmt(f),
46            Error::Unhandled(_) => {
47                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
48                    write!(f, "unhandled error ({code})")
49                } else {
50                    f.write_str("unhandled error")
51                }
52            }
53        }
54    }
55}
56impl From<::aws_smithy_types::error::operation::BuildError> for Error {
57    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
58        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
59            source: value.into(),
60            meta: ::std::default::Default::default(),
61        })
62    }
63}
64impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
65    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
66        match self {
67            Self::ExpiredIteratorException(inner) => inner.meta(),
68            Self::InternalServerError(inner) => inner.meta(),
69            Self::LimitExceededException(inner) => inner.meta(),
70            Self::ResourceNotFoundException(inner) => inner.meta(),
71            Self::TrimmedDataAccessException(inner) => inner.meta(),
72            Self::Unhandled(inner) => &inner.meta,
73        }
74    }
75}
76impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_stream::DescribeStreamError, R>> for Error
77where
78    R: Send + Sync + std::fmt::Debug + 'static,
79{
80    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_stream::DescribeStreamError, R>) -> Self {
81        match err {
82            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
83            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
84                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
85                source: err.into(),
86            }),
87        }
88    }
89}
90impl From<crate::operation::describe_stream::DescribeStreamError> for Error {
91    fn from(err: crate::operation::describe_stream::DescribeStreamError) -> Self {
92        match err {
93            crate::operation::describe_stream::DescribeStreamError::InternalServerError(inner) => Error::InternalServerError(inner),
94            crate::operation::describe_stream::DescribeStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
95            crate::operation::describe_stream::DescribeStreamError::Unhandled(inner) => Error::Unhandled(inner),
96        }
97    }
98}
99impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>> for Error
100where
101    R: Send + Sync + std::fmt::Debug + 'static,
102{
103    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_records::GetRecordsError, R>) -> Self {
104        match err {
105            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
106            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
107                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
108                source: err.into(),
109            }),
110        }
111    }
112}
113impl From<crate::operation::get_records::GetRecordsError> for Error {
114    fn from(err: crate::operation::get_records::GetRecordsError) -> Self {
115        match err {
116            crate::operation::get_records::GetRecordsError::ExpiredIteratorException(inner) => Error::ExpiredIteratorException(inner),
117            crate::operation::get_records::GetRecordsError::InternalServerError(inner) => Error::InternalServerError(inner),
118            crate::operation::get_records::GetRecordsError::LimitExceededException(inner) => Error::LimitExceededException(inner),
119            crate::operation::get_records::GetRecordsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
120            crate::operation::get_records::GetRecordsError::TrimmedDataAccessException(inner) => Error::TrimmedDataAccessException(inner),
121            crate::operation::get_records::GetRecordsError::Unhandled(inner) => Error::Unhandled(inner),
122        }
123    }
124}
125impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>> for Error
126where
127    R: Send + Sync + std::fmt::Debug + 'static,
128{
129    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_shard_iterator::GetShardIteratorError, R>) -> Self {
130        match err {
131            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
132            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
133                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
134                source: err.into(),
135            }),
136        }
137    }
138}
139impl From<crate::operation::get_shard_iterator::GetShardIteratorError> for Error {
140    fn from(err: crate::operation::get_shard_iterator::GetShardIteratorError) -> Self {
141        match err {
142            crate::operation::get_shard_iterator::GetShardIteratorError::InternalServerError(inner) => Error::InternalServerError(inner),
143            crate::operation::get_shard_iterator::GetShardIteratorError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
144            crate::operation::get_shard_iterator::GetShardIteratorError::TrimmedDataAccessException(inner) => {
145                Error::TrimmedDataAccessException(inner)
146            }
147            crate::operation::get_shard_iterator::GetShardIteratorError::Unhandled(inner) => Error::Unhandled(inner),
148        }
149    }
150}
151impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_streams::ListStreamsError, 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::list_streams::ListStreamsError, 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::list_streams::ListStreamsError> for Error {
166    fn from(err: crate::operation::list_streams::ListStreamsError) -> Self {
167        match err {
168            crate::operation::list_streams::ListStreamsError::InternalServerError(inner) => Error::InternalServerError(inner),
169            crate::operation::list_streams::ListStreamsError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
170            crate::operation::list_streams::ListStreamsError::Unhandled(inner) => Error::Unhandled(inner),
171        }
172    }
173}
174impl ::std::error::Error for Error {
175    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
176        match self {
177            Error::ExpiredIteratorException(inner) => inner.source(),
178            Error::InternalServerError(inner) => inner.source(),
179            Error::LimitExceededException(inner) => inner.source(),
180            Error::ResourceNotFoundException(inner) => inner.source(),
181            Error::TrimmedDataAccessException(inner) => inner.source(),
182            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
183        }
184    }
185}
186impl ::aws_types::request_id::RequestId for Error {
187    fn request_id(&self) -> Option<&str> {
188        match self {
189            Self::ExpiredIteratorException(e) => e.request_id(),
190            Self::InternalServerError(e) => e.request_id(),
191            Self::LimitExceededException(e) => e.request_id(),
192            Self::ResourceNotFoundException(e) => e.request_id(),
193            Self::TrimmedDataAccessException(e) => e.request_id(),
194            Self::Unhandled(e) => e.meta.request_id(),
195        }
196    }
197}