aws_sdk_iotjobsdataplane/
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 certificate is invalid.</p>
7    CertificateValidationException(crate::types::error::CertificateValidationException),
8    /// <p>A conflict has occurred when performing the API request.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>An internal server error occurred when performing the API request.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The contents of the request were invalid.</p>
13    InvalidRequestException(crate::types::error::InvalidRequestException),
14    /// <p>An update attempted to change the job execution to a state that is invalid because of the job execution's current state (for example, an attempt to change a request in state SUCCESS to state IN_PROGRESS). In this case, the body of the error message also contains the executionState field.</p>
15    InvalidStateTransitionException(crate::types::error::InvalidStateTransitionException),
16    /// <p>The specified resource does not exist.</p>
17    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
18    /// <p>The service quota has been exceeded for this request.</p>
19    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
20    /// <p>The service is temporarily unavailable.</p>
21    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
22    /// <p>The job is in a terminal state.</p>
23    TerminalStateException(crate::types::error::TerminalStateException),
24    /// <p>The rate exceeds the limit.</p>
25    ThrottlingException(crate::types::error::ThrottlingException),
26    /// <p>A validation error occurred when performing the API request.</p>
27    ValidationException(crate::types::error::ValidationException),
28    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
29    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
30    variable wildcard pattern and check `.code()`:
31     \
32    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
33     \
34    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
35    Unhandled(crate::error::sealed_unhandled::Unhandled),
36}
37impl ::std::fmt::Display for Error {
38    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39        match self {
40            Error::CertificateValidationException(inner) => inner.fmt(f),
41            Error::ConflictException(inner) => inner.fmt(f),
42            Error::InternalServerException(inner) => inner.fmt(f),
43            Error::InvalidRequestException(inner) => inner.fmt(f),
44            Error::InvalidStateTransitionException(inner) => inner.fmt(f),
45            Error::ResourceNotFoundException(inner) => inner.fmt(f),
46            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
47            Error::ServiceUnavailableException(inner) => inner.fmt(f),
48            Error::TerminalStateException(inner) => inner.fmt(f),
49            Error::ThrottlingException(inner) => inner.fmt(f),
50            Error::ValidationException(inner) => inner.fmt(f),
51            Error::Unhandled(_) => {
52                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
53                    write!(f, "unhandled error ({code})")
54                } else {
55                    f.write_str("unhandled error")
56                }
57            }
58        }
59    }
60}
61impl From<::aws_smithy_types::error::operation::BuildError> for Error {
62    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
63        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
64            source: value.into(),
65            meta: ::std::default::Default::default(),
66        })
67    }
68}
69impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
70    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
71        match self {
72            Self::CertificateValidationException(inner) => inner.meta(),
73            Self::ConflictException(inner) => inner.meta(),
74            Self::InternalServerException(inner) => inner.meta(),
75            Self::InvalidRequestException(inner) => inner.meta(),
76            Self::InvalidStateTransitionException(inner) => inner.meta(),
77            Self::ResourceNotFoundException(inner) => inner.meta(),
78            Self::ServiceQuotaExceededException(inner) => inner.meta(),
79            Self::ServiceUnavailableException(inner) => inner.meta(),
80            Self::TerminalStateException(inner) => inner.meta(),
81            Self::ThrottlingException(inner) => inner.meta(),
82            Self::ValidationException(inner) => inner.meta(),
83            Self::Unhandled(inner) => &inner.meta,
84        }
85    }
86}
87impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_job_execution::DescribeJobExecutionError, R>> for Error
88where
89    R: Send + Sync + std::fmt::Debug + 'static,
90{
91    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_job_execution::DescribeJobExecutionError, R>) -> Self {
92        match err {
93            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
94            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
95                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
96                source: err.into(),
97            }),
98        }
99    }
100}
101impl From<crate::operation::describe_job_execution::DescribeJobExecutionError> for Error {
102    fn from(err: crate::operation::describe_job_execution::DescribeJobExecutionError) -> Self {
103        match err {
104            crate::operation::describe_job_execution::DescribeJobExecutionError::CertificateValidationException(inner) => {
105                Error::CertificateValidationException(inner)
106            }
107            crate::operation::describe_job_execution::DescribeJobExecutionError::InvalidRequestException(inner) => {
108                Error::InvalidRequestException(inner)
109            }
110            crate::operation::describe_job_execution::DescribeJobExecutionError::ResourceNotFoundException(inner) => {
111                Error::ResourceNotFoundException(inner)
112            }
113            crate::operation::describe_job_execution::DescribeJobExecutionError::ServiceUnavailableException(inner) => {
114                Error::ServiceUnavailableException(inner)
115            }
116            crate::operation::describe_job_execution::DescribeJobExecutionError::TerminalStateException(inner) => {
117                Error::TerminalStateException(inner)
118            }
119            crate::operation::describe_job_execution::DescribeJobExecutionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
120            crate::operation::describe_job_execution::DescribeJobExecutionError::Unhandled(inner) => Error::Unhandled(inner),
121        }
122    }
123}
124impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_pending_job_executions::GetPendingJobExecutionsError, R>>
125    for Error
126where
127    R: Send + Sync + std::fmt::Debug + 'static,
128{
129    fn from(
130        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_pending_job_executions::GetPendingJobExecutionsError, R>,
131    ) -> Self {
132        match err {
133            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
134            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
135                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
136                source: err.into(),
137            }),
138        }
139    }
140}
141impl From<crate::operation::get_pending_job_executions::GetPendingJobExecutionsError> for Error {
142    fn from(err: crate::operation::get_pending_job_executions::GetPendingJobExecutionsError) -> Self {
143        match err {
144            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::CertificateValidationException(inner) => {
145                Error::CertificateValidationException(inner)
146            }
147            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::InvalidRequestException(inner) => {
148                Error::InvalidRequestException(inner)
149            }
150            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::ResourceNotFoundException(inner) => {
151                Error::ResourceNotFoundException(inner)
152            }
153            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::ServiceUnavailableException(inner) => {
154                Error::ServiceUnavailableException(inner)
155            }
156            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::ThrottlingException(inner) => {
157                Error::ThrottlingException(inner)
158            }
159            crate::operation::get_pending_job_executions::GetPendingJobExecutionsError::Unhandled(inner) => Error::Unhandled(inner),
160        }
161    }
162}
163impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_command_execution::StartCommandExecutionError, R>> for Error
164where
165    R: Send + Sync + std::fmt::Debug + 'static,
166{
167    fn from(
168        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_command_execution::StartCommandExecutionError, R>,
169    ) -> Self {
170        match err {
171            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
172            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
173                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
174                source: err.into(),
175            }),
176        }
177    }
178}
179impl From<crate::operation::start_command_execution::StartCommandExecutionError> for Error {
180    fn from(err: crate::operation::start_command_execution::StartCommandExecutionError) -> Self {
181        match err {
182            crate::operation::start_command_execution::StartCommandExecutionError::ConflictException(inner) => Error::ConflictException(inner),
183            crate::operation::start_command_execution::StartCommandExecutionError::InternalServerException(inner) => {
184                Error::InternalServerException(inner)
185            }
186            crate::operation::start_command_execution::StartCommandExecutionError::ResourceNotFoundException(inner) => {
187                Error::ResourceNotFoundException(inner)
188            }
189            crate::operation::start_command_execution::StartCommandExecutionError::ServiceQuotaExceededException(inner) => {
190                Error::ServiceQuotaExceededException(inner)
191            }
192            crate::operation::start_command_execution::StartCommandExecutionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
193            crate::operation::start_command_execution::StartCommandExecutionError::ValidationException(inner) => Error::ValidationException(inner),
194            crate::operation::start_command_execution::StartCommandExecutionError::Unhandled(inner) => Error::Unhandled(inner),
195        }
196    }
197}
198impl<R>
199    From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError, R>>
200    for Error
201where
202    R: Send + Sync + std::fmt::Debug + 'static,
203{
204    fn from(
205        err: ::aws_smithy_runtime_api::client::result::SdkError<
206            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError,
207            R,
208        >,
209    ) -> Self {
210        match err {
211            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
212            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
213                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
214                source: err.into(),
215            }),
216        }
217    }
218}
219impl From<crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError> for Error {
220    fn from(err: crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError) -> Self {
221        match err {
222            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::CertificateValidationException(inner) => {
223                Error::CertificateValidationException(inner)
224            }
225            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::InvalidRequestException(inner) => {
226                Error::InvalidRequestException(inner)
227            }
228            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::ResourceNotFoundException(inner) => {
229                Error::ResourceNotFoundException(inner)
230            }
231            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::ServiceUnavailableException(inner) => {
232                Error::ServiceUnavailableException(inner)
233            }
234            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::ThrottlingException(inner) => {
235                Error::ThrottlingException(inner)
236            }
237            crate::operation::start_next_pending_job_execution::StartNextPendingJobExecutionError::Unhandled(inner) => Error::Unhandled(inner),
238        }
239    }
240}
241impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_job_execution::UpdateJobExecutionError, R>> for Error
242where
243    R: Send + Sync + std::fmt::Debug + 'static,
244{
245    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_job_execution::UpdateJobExecutionError, R>) -> Self {
246        match err {
247            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
248            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
249                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
250                source: err.into(),
251            }),
252        }
253    }
254}
255impl From<crate::operation::update_job_execution::UpdateJobExecutionError> for Error {
256    fn from(err: crate::operation::update_job_execution::UpdateJobExecutionError) -> Self {
257        match err {
258            crate::operation::update_job_execution::UpdateJobExecutionError::CertificateValidationException(inner) => {
259                Error::CertificateValidationException(inner)
260            }
261            crate::operation::update_job_execution::UpdateJobExecutionError::InvalidRequestException(inner) => Error::InvalidRequestException(inner),
262            crate::operation::update_job_execution::UpdateJobExecutionError::InvalidStateTransitionException(inner) => {
263                Error::InvalidStateTransitionException(inner)
264            }
265            crate::operation::update_job_execution::UpdateJobExecutionError::ResourceNotFoundException(inner) => {
266                Error::ResourceNotFoundException(inner)
267            }
268            crate::operation::update_job_execution::UpdateJobExecutionError::ServiceUnavailableException(inner) => {
269                Error::ServiceUnavailableException(inner)
270            }
271            crate::operation::update_job_execution::UpdateJobExecutionError::ThrottlingException(inner) => Error::ThrottlingException(inner),
272            crate::operation::update_job_execution::UpdateJobExecutionError::Unhandled(inner) => Error::Unhandled(inner),
273        }
274    }
275}
276impl ::std::error::Error for Error {
277    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
278        match self {
279            Error::CertificateValidationException(inner) => inner.source(),
280            Error::ConflictException(inner) => inner.source(),
281            Error::InternalServerException(inner) => inner.source(),
282            Error::InvalidRequestException(inner) => inner.source(),
283            Error::InvalidStateTransitionException(inner) => inner.source(),
284            Error::ResourceNotFoundException(inner) => inner.source(),
285            Error::ServiceQuotaExceededException(inner) => inner.source(),
286            Error::ServiceUnavailableException(inner) => inner.source(),
287            Error::TerminalStateException(inner) => inner.source(),
288            Error::ThrottlingException(inner) => inner.source(),
289            Error::ValidationException(inner) => inner.source(),
290            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
291        }
292    }
293}
294impl ::aws_types::request_id::RequestId for Error {
295    fn request_id(&self) -> Option<&str> {
296        match self {
297            Self::CertificateValidationException(e) => e.request_id(),
298            Self::ConflictException(e) => e.request_id(),
299            Self::InternalServerException(e) => e.request_id(),
300            Self::InvalidRequestException(e) => e.request_id(),
301            Self::InvalidStateTransitionException(e) => e.request_id(),
302            Self::ResourceNotFoundException(e) => e.request_id(),
303            Self::ServiceQuotaExceededException(e) => e.request_id(),
304            Self::ServiceUnavailableException(e) => e.request_id(),
305            Self::TerminalStateException(e) => e.request_id(),
306            Self::ThrottlingException(e) => e.request_id(),
307            Self::ValidationException(e) => e.request_id(),
308            Self::Unhandled(e) => e.meta.request_id(),
309        }
310    }
311}