Skip to main content

aws_sdk_sagemakerjobruntime/
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    /// You do not have permission to perform this operation.
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// The request conflicts with the current state of the resource.
9    ConflictException(crate::types::error::ConflictException),
10    /// An internal service error occurred. Retry the request.
11    InternalServiceError(crate::types::error::InternalServiceError),
12    /// The specified resource was not found.
13    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14    /// You have exceeded a service quota.
15    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16    /// The request was throttled. Retry the request after a brief wait.
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// The request is not valid. Check the request syntax and parameters
19    ValidationException(crate::types::error::ValidationException),
20    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
21    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
22    variable wildcard pattern and check `.code()`:
23     \
24       `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
25     \
26    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
27    Unhandled(crate::error::sealed_unhandled::Unhandled),
28}
29impl ::std::fmt::Display for Error {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        match self {
32            Error::AccessDeniedException(inner) => inner.fmt(f),
33            Error::ConflictException(inner) => inner.fmt(f),
34            Error::InternalServiceError(inner) => inner.fmt(f),
35            Error::ResourceNotFoundException(inner) => inner.fmt(f),
36            Error::ServiceQuotaExceededException(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::ConflictException(inner) => inner.meta(),
62            Self::InternalServiceError(inner) => inner.meta(),
63            Self::ResourceNotFoundException(inner) => inner.meta(),
64            Self::ServiceQuotaExceededException(inner) => inner.meta(),
65            Self::ThrottlingException(inner) => inner.meta(),
66            Self::ValidationException(inner) => inner.meta(),
67            Self::Unhandled(inner) => &inner.meta,
68        }
69    }
70}
71impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_rollout::CompleteRolloutError, R>> for Error
72where
73    R: Send + Sync + std::fmt::Debug + 'static,
74{
75    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::complete_rollout::CompleteRolloutError, R>) -> Self {
76        match err {
77            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
78            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
79                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
80                source: err.into(),
81            }),
82        }
83    }
84}
85impl From<crate::operation::complete_rollout::CompleteRolloutError> for Error {
86    fn from(err: crate::operation::complete_rollout::CompleteRolloutError) -> Self {
87        match err {
88            crate::operation::complete_rollout::CompleteRolloutError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89            crate::operation::complete_rollout::CompleteRolloutError::ConflictException(inner) => Error::ConflictException(inner),
90            crate::operation::complete_rollout::CompleteRolloutError::InternalServiceError(inner) => Error::InternalServiceError(inner),
91            crate::operation::complete_rollout::CompleteRolloutError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
92            crate::operation::complete_rollout::CompleteRolloutError::ServiceQuotaExceededException(inner) => {
93                Error::ServiceQuotaExceededException(inner)
94            }
95            crate::operation::complete_rollout::CompleteRolloutError::ThrottlingException(inner) => Error::ThrottlingException(inner),
96            crate::operation::complete_rollout::CompleteRolloutError::ValidationException(inner) => Error::ValidationException(inner),
97            crate::operation::complete_rollout::CompleteRolloutError::Unhandled(inner) => Error::Unhandled(inner),
98        }
99    }
100}
101impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::sample::SampleError, R>> for Error
102where
103    R: Send + Sync + std::fmt::Debug + 'static,
104{
105    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::sample::SampleError, R>) -> Self {
106        match err {
107            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
108            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
109                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
110                source: err.into(),
111            }),
112        }
113    }
114}
115impl From<crate::operation::sample::SampleError> for Error {
116    fn from(err: crate::operation::sample::SampleError) -> Self {
117        match err {
118            crate::operation::sample::SampleError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
119            crate::operation::sample::SampleError::InternalServiceError(inner) => Error::InternalServiceError(inner),
120            crate::operation::sample::SampleError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
121            crate::operation::sample::SampleError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
122            crate::operation::sample::SampleError::ThrottlingException(inner) => Error::ThrottlingException(inner),
123            crate::operation::sample::SampleError::ValidationException(inner) => Error::ValidationException(inner),
124            crate::operation::sample::SampleError::Unhandled(inner) => Error::Unhandled(inner),
125        }
126    }
127}
128impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::sample_with_response_stream::SampleWithResponseStreamError, R>>
129    for Error
130where
131    R: Send + Sync + std::fmt::Debug + 'static,
132{
133    fn from(
134        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::sample_with_response_stream::SampleWithResponseStreamError, R>,
135    ) -> Self {
136        match err {
137            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
138            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
139                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
140                source: err.into(),
141            }),
142        }
143    }
144}
145impl From<crate::operation::sample_with_response_stream::SampleWithResponseStreamError> for Error {
146    fn from(err: crate::operation::sample_with_response_stream::SampleWithResponseStreamError) -> Self {
147        match err {
148            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::AccessDeniedException(inner) => {
149                Error::AccessDeniedException(inner)
150            }
151            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::InternalServiceError(inner) => {
152                Error::InternalServiceError(inner)
153            }
154            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::ResourceNotFoundException(inner) => {
155                Error::ResourceNotFoundException(inner)
156            }
157            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::ServiceQuotaExceededException(inner) => {
158                Error::ServiceQuotaExceededException(inner)
159            }
160            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::ThrottlingException(inner) => {
161                Error::ThrottlingException(inner)
162            }
163            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::ValidationException(inner) => {
164                Error::ValidationException(inner)
165            }
166            crate::operation::sample_with_response_stream::SampleWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
167        }
168    }
169}
170impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_reward::UpdateRewardError, R>> for Error
171where
172    R: Send + Sync + std::fmt::Debug + 'static,
173{
174    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_reward::UpdateRewardError, R>) -> Self {
175        match err {
176            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
177            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
178                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
179                source: err.into(),
180            }),
181        }
182    }
183}
184impl From<crate::operation::update_reward::UpdateRewardError> for Error {
185    fn from(err: crate::operation::update_reward::UpdateRewardError) -> Self {
186        match err {
187            crate::operation::update_reward::UpdateRewardError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
188            crate::operation::update_reward::UpdateRewardError::ConflictException(inner) => Error::ConflictException(inner),
189            crate::operation::update_reward::UpdateRewardError::InternalServiceError(inner) => Error::InternalServiceError(inner),
190            crate::operation::update_reward::UpdateRewardError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
191            crate::operation::update_reward::UpdateRewardError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
192            crate::operation::update_reward::UpdateRewardError::ThrottlingException(inner) => Error::ThrottlingException(inner),
193            crate::operation::update_reward::UpdateRewardError::ValidationException(inner) => Error::ValidationException(inner),
194            crate::operation::update_reward::UpdateRewardError::Unhandled(inner) => Error::Unhandled(inner),
195        }
196    }
197}
198impl ::std::error::Error for Error {
199    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
200        match self {
201            Error::AccessDeniedException(inner) => inner.source(),
202            Error::ConflictException(inner) => inner.source(),
203            Error::InternalServiceError(inner) => inner.source(),
204            Error::ResourceNotFoundException(inner) => inner.source(),
205            Error::ServiceQuotaExceededException(inner) => inner.source(),
206            Error::ThrottlingException(inner) => inner.source(),
207            Error::ValidationException(inner) => inner.source(),
208            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
209        }
210    }
211}
212impl ::aws_types::request_id::RequestId for Error {
213    fn request_id(&self) -> Option<&str> {
214        match self {
215            Self::AccessDeniedException(e) => e.request_id(),
216            Self::ConflictException(e) => e.request_id(),
217            Self::InternalServiceError(e) => e.request_id(),
218            Self::ResourceNotFoundException(e) => e.request_id(),
219            Self::ServiceQuotaExceededException(e) => e.request_id(),
220            Self::ThrottlingException(e) => e.request_id(),
221            Self::ValidationException(e) => e.request_id(),
222            Self::Unhandled(e) => e.meta.request_id(),
223        }
224    }
225}