Skip to main content

aws_sdk_connectscheduling/
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>You do not have sufficient permissions to perform this action.</p>
7    AccessDeniedException(crate::types::error::AccessDeniedException),
8    /// <p>The request could not be processed because of a conflict with the current state of the resource.</p>
9    ConflictException(crate::types::error::ConflictException),
10    /// <p>The request processing failed because of an error or failure with the service.</p>
11    InternalServerException(crate::types::error::InternalServerException),
12    /// <p>The specified resource was not found.</p>
13    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
14    /// <p>The request would cause a service quota to be exceeded.</p>
15    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
16    /// <p>The request was denied due to request throttling.</p>
17    ThrottlingException(crate::types::error::ThrottlingException),
18    /// <p>The input fails to satisfy the constraints specified by an AWS service.</p>
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    &nbsp;&nbsp;&nbsp;`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::InternalServerException(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::InternalServerException(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::approve_time_off::ApproveTimeOffError, 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::approve_time_off::ApproveTimeOffError, 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::approve_time_off::ApproveTimeOffError> for Error {
86    fn from(err: crate::operation::approve_time_off::ApproveTimeOffError) -> Self {
87        match err {
88            crate::operation::approve_time_off::ApproveTimeOffError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
89            crate::operation::approve_time_off::ApproveTimeOffError::ConflictException(inner) => Error::ConflictException(inner),
90            crate::operation::approve_time_off::ApproveTimeOffError::InternalServerException(inner) => Error::InternalServerException(inner),
91            crate::operation::approve_time_off::ApproveTimeOffError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
92            crate::operation::approve_time_off::ApproveTimeOffError::ThrottlingException(inner) => Error::ThrottlingException(inner),
93            crate::operation::approve_time_off::ApproveTimeOffError::ValidationException(inner) => Error::ValidationException(inner),
94            crate::operation::approve_time_off::ApproveTimeOffError::Unhandled(inner) => Error::Unhandled(inner),
95        }
96    }
97}
98impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_time_off::CancelTimeOffError, R>> for Error
99where
100    R: Send + Sync + std::fmt::Debug + 'static,
101{
102    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::cancel_time_off::CancelTimeOffError, R>) -> Self {
103        match err {
104            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
105            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
106                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
107                source: err.into(),
108            }),
109        }
110    }
111}
112impl From<crate::operation::cancel_time_off::CancelTimeOffError> for Error {
113    fn from(err: crate::operation::cancel_time_off::CancelTimeOffError) -> Self {
114        match err {
115            crate::operation::cancel_time_off::CancelTimeOffError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
116            crate::operation::cancel_time_off::CancelTimeOffError::ConflictException(inner) => Error::ConflictException(inner),
117            crate::operation::cancel_time_off::CancelTimeOffError::InternalServerException(inner) => Error::InternalServerException(inner),
118            crate::operation::cancel_time_off::CancelTimeOffError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
119            crate::operation::cancel_time_off::CancelTimeOffError::ThrottlingException(inner) => Error::ThrottlingException(inner),
120            crate::operation::cancel_time_off::CancelTimeOffError::ValidationException(inner) => Error::ValidationException(inner),
121            crate::operation::cancel_time_off::CancelTimeOffError::Unhandled(inner) => Error::Unhandled(inner),
122        }
123    }
124}
125impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_time_off::CreateTimeOffError, 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::create_time_off::CreateTimeOffError, 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::create_time_off::CreateTimeOffError> for Error {
140    fn from(err: crate::operation::create_time_off::CreateTimeOffError) -> Self {
141        match err {
142            crate::operation::create_time_off::CreateTimeOffError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
143            crate::operation::create_time_off::CreateTimeOffError::ConflictException(inner) => Error::ConflictException(inner),
144            crate::operation::create_time_off::CreateTimeOffError::InternalServerException(inner) => Error::InternalServerException(inner),
145            crate::operation::create_time_off::CreateTimeOffError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
146            crate::operation::create_time_off::CreateTimeOffError::ServiceQuotaExceededException(inner) => {
147                Error::ServiceQuotaExceededException(inner)
148            }
149            crate::operation::create_time_off::CreateTimeOffError::ThrottlingException(inner) => Error::ThrottlingException(inner),
150            crate::operation::create_time_off::CreateTimeOffError::ValidationException(inner) => Error::ValidationException(inner),
151            crate::operation::create_time_off::CreateTimeOffError::Unhandled(inner) => Error::Unhandled(inner),
152        }
153    }
154}
155impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_time_off::GetTimeOffError, R>> for Error
156where
157    R: Send + Sync + std::fmt::Debug + 'static,
158{
159    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_time_off::GetTimeOffError, R>) -> Self {
160        match err {
161            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
162            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
163                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
164                source: err.into(),
165            }),
166        }
167    }
168}
169impl From<crate::operation::get_time_off::GetTimeOffError> for Error {
170    fn from(err: crate::operation::get_time_off::GetTimeOffError) -> Self {
171        match err {
172            crate::operation::get_time_off::GetTimeOffError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
173            crate::operation::get_time_off::GetTimeOffError::InternalServerException(inner) => Error::InternalServerException(inner),
174            crate::operation::get_time_off::GetTimeOffError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
175            crate::operation::get_time_off::GetTimeOffError::ThrottlingException(inner) => Error::ThrottlingException(inner),
176            crate::operation::get_time_off::GetTimeOffError::ValidationException(inner) => Error::ValidationException(inner),
177            crate::operation::get_time_off::GetTimeOffError::Unhandled(inner) => Error::Unhandled(inner),
178        }
179    }
180}
181impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_time_off_balance::PutTimeOffBalanceError, R>> for Error
182where
183    R: Send + Sync + std::fmt::Debug + 'static,
184{
185    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_time_off_balance::PutTimeOffBalanceError, R>) -> Self {
186        match err {
187            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
188            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
189                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
190                source: err.into(),
191            }),
192        }
193    }
194}
195impl From<crate::operation::put_time_off_balance::PutTimeOffBalanceError> for Error {
196    fn from(err: crate::operation::put_time_off_balance::PutTimeOffBalanceError) -> Self {
197        match err {
198            crate::operation::put_time_off_balance::PutTimeOffBalanceError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
199            crate::operation::put_time_off_balance::PutTimeOffBalanceError::ConflictException(inner) => Error::ConflictException(inner),
200            crate::operation::put_time_off_balance::PutTimeOffBalanceError::InternalServerException(inner) => Error::InternalServerException(inner),
201            crate::operation::put_time_off_balance::PutTimeOffBalanceError::ResourceNotFoundException(inner) => {
202                Error::ResourceNotFoundException(inner)
203            }
204            crate::operation::put_time_off_balance::PutTimeOffBalanceError::ThrottlingException(inner) => Error::ThrottlingException(inner),
205            crate::operation::put_time_off_balance::PutTimeOffBalanceError::ValidationException(inner) => Error::ValidationException(inner),
206            crate::operation::put_time_off_balance::PutTimeOffBalanceError::Unhandled(inner) => Error::Unhandled(inner),
207        }
208    }
209}
210impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::reject_time_off::RejectTimeOffError, R>> for Error
211where
212    R: Send + Sync + std::fmt::Debug + 'static,
213{
214    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::reject_time_off::RejectTimeOffError, R>) -> Self {
215        match err {
216            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
217            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
218                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
219                source: err.into(),
220            }),
221        }
222    }
223}
224impl From<crate::operation::reject_time_off::RejectTimeOffError> for Error {
225    fn from(err: crate::operation::reject_time_off::RejectTimeOffError) -> Self {
226        match err {
227            crate::operation::reject_time_off::RejectTimeOffError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
228            crate::operation::reject_time_off::RejectTimeOffError::ConflictException(inner) => Error::ConflictException(inner),
229            crate::operation::reject_time_off::RejectTimeOffError::InternalServerException(inner) => Error::InternalServerException(inner),
230            crate::operation::reject_time_off::RejectTimeOffError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
231            crate::operation::reject_time_off::RejectTimeOffError::ThrottlingException(inner) => Error::ThrottlingException(inner),
232            crate::operation::reject_time_off::RejectTimeOffError::ValidationException(inner) => Error::ValidationException(inner),
233            crate::operation::reject_time_off::RejectTimeOffError::Unhandled(inner) => Error::Unhandled(inner),
234        }
235    }
236}
237impl ::std::error::Error for Error {
238    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
239        match self {
240            Error::AccessDeniedException(inner) => inner.source(),
241            Error::ConflictException(inner) => inner.source(),
242            Error::InternalServerException(inner) => inner.source(),
243            Error::ResourceNotFoundException(inner) => inner.source(),
244            Error::ServiceQuotaExceededException(inner) => inner.source(),
245            Error::ThrottlingException(inner) => inner.source(),
246            Error::ValidationException(inner) => inner.source(),
247            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
248        }
249    }
250}
251impl ::aws_types::request_id::RequestId for Error {
252    fn request_id(&self) -> Option<&str> {
253        match self {
254            Self::AccessDeniedException(e) => e.request_id(),
255            Self::ConflictException(e) => e.request_id(),
256            Self::InternalServerException(e) => e.request_id(),
257            Self::ResourceNotFoundException(e) => e.request_id(),
258            Self::ServiceQuotaExceededException(e) => e.request_id(),
259            Self::ThrottlingException(e) => e.request_id(),
260            Self::ValidationException(e) => e.request_id(),
261            Self::Unhandled(e) => e.meta.request_id(),
262        }
263    }
264}