aws_sdk_sagemakergatewayruntime/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 AccessDeniedException(crate::types::error::AccessDeniedException),
8 BadGatewayException(crate::types::error::BadGatewayException),
20 GatewayTimeoutException(crate::types::error::GatewayTimeoutException),
29 InternalServerException(crate::types::error::InternalServerException),
31 InternalStreamFailure(crate::types::error::InternalStreamFailure),
33 ModelStreamError(crate::types::error::ModelStreamError),
35 PayloadTooLargeException(crate::types::error::PayloadTooLargeException),
37 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
39 ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
41 ThrottlingException(crate::types::error::ThrottlingException),
43 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
45 variable wildcard pattern and check `.code()`:
46 \
47 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
48 \
49 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
50 Unhandled(crate::error::sealed_unhandled::Unhandled),
51}
52impl ::std::fmt::Display for Error {
53 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
54 match self {
55 Error::AccessDeniedException(inner) => inner.fmt(f),
56 Error::BadGatewayException(inner) => inner.fmt(f),
57 Error::GatewayTimeoutException(inner) => inner.fmt(f),
58 Error::InternalServerException(inner) => inner.fmt(f),
59 Error::InternalStreamFailure(inner) => inner.fmt(f),
60 Error::ModelStreamError(inner) => inner.fmt(f),
61 Error::PayloadTooLargeException(inner) => inner.fmt(f),
62 Error::ResourceNotFoundException(inner) => inner.fmt(f),
63 Error::ServiceUnavailableException(inner) => inner.fmt(f),
64 Error::ThrottlingException(inner) => inner.fmt(f),
65 Error::Unhandled(_) => {
66 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
67 write!(f, "unhandled error ({code})")
68 } else {
69 f.write_str("unhandled error")
70 }
71 }
72 }
73 }
74}
75impl From<::aws_smithy_types::error::operation::BuildError> for Error {
76 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
77 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
78 source: value.into(),
79 meta: ::std::default::Default::default(),
80 })
81 }
82}
83impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
84 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
85 match self {
86 Self::AccessDeniedException(inner) => inner.meta(),
87 Self::BadGatewayException(inner) => inner.meta(),
88 Self::GatewayTimeoutException(inner) => inner.meta(),
89 Self::InternalServerException(inner) => inner.meta(),
90 Self::InternalStreamFailure(inner) => inner.meta(),
91 Self::ModelStreamError(inner) => inner.meta(),
92 Self::PayloadTooLargeException(inner) => inner.meta(),
93 Self::ResourceNotFoundException(inner) => inner.meta(),
94 Self::ServiceUnavailableException(inner) => inner.meta(),
95 Self::ThrottlingException(inner) => inner.meta(),
96 Self::Unhandled(inner) => &inner.meta,
97 }
98 }
99}
100impl<R>
101 From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError, R>>
102 for Error
103where
104 R: Send + Sync + std::fmt::Debug + 'static,
105{
106 fn from(
107 err: ::aws_smithy_runtime_api::client::result::SdkError<
108 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError,
109 R,
110 >,
111 ) -> Self {
112 match err {
113 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
114 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
115 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
116 source: err.into(),
117 }),
118 }
119 }
120}
121impl From<crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError> for Error {
122 fn from(err: crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError) -> Self {
123 match err {
124 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::AccessDeniedException(inner) => {
125 Error::AccessDeniedException(inner)
126 }
127 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::BadGatewayException(inner) => {
128 Error::BadGatewayException(inner)
129 }
130 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::GatewayTimeoutException(inner) => {
131 Error::GatewayTimeoutException(inner)
132 }
133 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::InternalServerException(inner) => {
134 Error::InternalServerException(inner)
135 }
136 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::PayloadTooLargeException(inner) => {
137 Error::PayloadTooLargeException(inner)
138 }
139 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::ResourceNotFoundException(inner) => {
140 Error::ResourceNotFoundException(inner)
141 }
142 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::ServiceUnavailableException(inner) => {
143 Error::ServiceUnavailableException(inner)
144 }
145 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::ThrottlingException(inner) => {
146 Error::ThrottlingException(inner)
147 }
148 crate::operation::invoke_global_inference_gateway::InvokeGlobalInferenceGatewayError::Unhandled(inner) => Error::Unhandled(inner),
149 }
150 }
151}
152impl<R>
153 From<
154 ::aws_smithy_runtime_api::client::result::SdkError<
155 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError,
156 R,
157 >,
158 > for Error
159where
160 R: Send + Sync + std::fmt::Debug + 'static,
161{
162 fn from(
163 err: ::aws_smithy_runtime_api::client::result::SdkError<
164 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError,
165 R,
166 >,
167 ) -> Self {
168 match err {
169 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
170 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
171 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
172 source: err.into(),
173 }),
174 }
175 }
176}
177impl From<crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError> for Error {
178 fn from(
179 err: crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError,
180 ) -> Self {
181 match err {
182 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
183 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::BadGatewayException(inner) => Error::BadGatewayException(inner),
184 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::GatewayTimeoutException(inner) => Error::GatewayTimeoutException(inner),
185 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
186 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::InternalStreamFailure(inner) => Error::InternalStreamFailure(inner),
187 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::ModelStreamError(inner) => Error::ModelStreamError(inner),
188 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::PayloadTooLargeException(inner) => Error::PayloadTooLargeException(inner),
189 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
190 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
191 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
192 crate::operation::invoke_global_inference_gateway_with_response_stream::InvokeGlobalInferenceGatewayWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
193 }
194 }
195}
196impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>> for Error
197where
198 R: Send + Sync + std::fmt::Debug + 'static,
199{
200 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>) -> Self {
201 match err {
202 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
203 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
204 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
205 source: err.into(),
206 }),
207 }
208 }
209}
210impl From<crate::types::error::ResponseStreamError> for Error {
211 fn from(err: crate::types::error::ResponseStreamError) -> Self {
212 match err {
213 crate::types::error::ResponseStreamError::ModelStreamError(inner) => Error::ModelStreamError(inner),
214 crate::types::error::ResponseStreamError::InternalStreamFailure(inner) => Error::InternalStreamFailure(inner),
215 crate::types::error::ResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
216 }
217 }
218}
219impl ::std::error::Error for Error {
220 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
221 match self {
222 Error::AccessDeniedException(inner) => inner.source(),
223 Error::BadGatewayException(inner) => inner.source(),
224 Error::GatewayTimeoutException(inner) => inner.source(),
225 Error::InternalServerException(inner) => inner.source(),
226 Error::InternalStreamFailure(inner) => inner.source(),
227 Error::ModelStreamError(inner) => inner.source(),
228 Error::PayloadTooLargeException(inner) => inner.source(),
229 Error::ResourceNotFoundException(inner) => inner.source(),
230 Error::ServiceUnavailableException(inner) => inner.source(),
231 Error::ThrottlingException(inner) => inner.source(),
232 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
233 }
234 }
235}
236impl ::aws_types::request_id::RequestId for Error {
237 fn request_id(&self) -> Option<&str> {
238 match self {
239 Self::AccessDeniedException(e) => e.request_id(),
240 Self::BadGatewayException(e) => e.request_id(),
241 Self::GatewayTimeoutException(e) => e.request_id(),
242 Self::InternalServerException(e) => e.request_id(),
243 Self::InternalStreamFailure(e) => e.request_id(),
244 Self::ModelStreamError(e) => e.request_id(),
245 Self::PayloadTooLargeException(e) => e.request_id(),
246 Self::ResourceNotFoundException(e) => e.request_id(),
247 Self::ServiceUnavailableException(e) => e.request_id(),
248 Self::ThrottlingException(e) => e.request_id(),
249 Self::Unhandled(e) => e.meta.request_id(),
250 }
251 }
252}