Skip to main content

aws_sdk_signerdata/
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>An internal service error occurred.</p>
9    InternalServiceErrorException(crate::types::error::InternalServiceErrorException),
10    /// <p>The request was denied due to request throttling.</p>
11    TooManyRequestsException(crate::types::error::TooManyRequestsException),
12    /// <p>The request contains invalid parameters or is malformed.</p>
13    ValidationException(crate::types::error::ValidationException),
14    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
15    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16    variable wildcard pattern and check `.code()`:
17     \
18    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
19     \
20    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
21    Unhandled(crate::error::sealed_unhandled::Unhandled),
22}
23impl ::std::fmt::Display for Error {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            Error::AccessDeniedException(inner) => inner.fmt(f),
27            Error::InternalServiceErrorException(inner) => inner.fmt(f),
28            Error::TooManyRequestsException(inner) => inner.fmt(f),
29            Error::ValidationException(inner) => inner.fmt(f),
30            Error::Unhandled(_) => {
31                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
32                    write!(f, "unhandled error ({code})")
33                } else {
34                    f.write_str("unhandled error")
35                }
36            }
37        }
38    }
39}
40impl From<::aws_smithy_types::error::operation::BuildError> for Error {
41    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
42        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
43            source: value.into(),
44            meta: ::std::default::Default::default(),
45        })
46    }
47}
48impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
49    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
50        match self {
51            Self::AccessDeniedException(inner) => inner.meta(),
52            Self::InternalServiceErrorException(inner) => inner.meta(),
53            Self::TooManyRequestsException(inner) => inner.meta(),
54            Self::ValidationException(inner) => inner.meta(),
55            Self::Unhandled(inner) => &inner.meta,
56        }
57    }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_revocation_status::GetRevocationStatusError, R>> for Error
60where
61    R: Send + Sync + std::fmt::Debug + 'static,
62{
63    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_revocation_status::GetRevocationStatusError, R>) -> Self {
64        match err {
65            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
66            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
67                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
68                source: err.into(),
69            }),
70        }
71    }
72}
73impl From<crate::operation::get_revocation_status::GetRevocationStatusError> for Error {
74    fn from(err: crate::operation::get_revocation_status::GetRevocationStatusError) -> Self {
75        match err {
76            crate::operation::get_revocation_status::GetRevocationStatusError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
77            crate::operation::get_revocation_status::GetRevocationStatusError::InternalServiceErrorException(inner) => {
78                Error::InternalServiceErrorException(inner)
79            }
80            crate::operation::get_revocation_status::GetRevocationStatusError::TooManyRequestsException(inner) => {
81                Error::TooManyRequestsException(inner)
82            }
83            crate::operation::get_revocation_status::GetRevocationStatusError::ValidationException(inner) => Error::ValidationException(inner),
84            crate::operation::get_revocation_status::GetRevocationStatusError::Unhandled(inner) => Error::Unhandled(inner),
85        }
86    }
87}
88impl ::std::error::Error for Error {
89    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
90        match self {
91            Error::AccessDeniedException(inner) => inner.source(),
92            Error::InternalServiceErrorException(inner) => inner.source(),
93            Error::TooManyRequestsException(inner) => inner.source(),
94            Error::ValidationException(inner) => inner.source(),
95            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
96        }
97    }
98}
99impl ::aws_types::request_id::RequestId for Error {
100    fn request_id(&self) -> Option<&str> {
101        match self {
102            Self::AccessDeniedException(e) => e.request_id(),
103            Self::InternalServiceErrorException(e) => e.request_id(),
104            Self::TooManyRequestsException(e) => e.request_id(),
105            Self::ValidationException(e) => e.request_id(),
106            Self::Unhandled(e) => e.meta.request_id(),
107        }
108    }
109}