Skip to main content

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