aws_sdk_dynamodbstreams/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 ExpiredIteratorException(crate::types::error::ExpiredIteratorException),
8 InternalServerError(crate::types::error::InternalServerError),
10 LimitExceededException(crate::types::error::LimitExceededException),
18 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
20 TrimmedDataAccessException(crate::types::error::TrimmedDataAccessException),
29 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
31 variable wildcard pattern and check `.code()`:
32 \
33 `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}