aws_sdk_workmailmessageflow/
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>WorkMail could not access the updated email content. Possible reasons:</p>
7    /// <ul>
8    /// <li>
9    /// <p>You made the request in a region other than your S3 bucket region.</p></li>
10    /// <li>
11    /// <p>The <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-owner-condition.html">S3 bucket owner</a> is not the same as the calling AWS account.</p></li>
12    /// <li>
13    /// <p>You have an incomplete or missing S3 bucket policy. For more information about policies, see <a href="https://docs.aws.amazon.com/workmail/latest/adminguide/update-with-lambda.html"> Updating message content with AWS Lambda </a> in the <i>WorkMail Administrator Guide</i>.</p></li>
14    /// </ul>
15    InvalidContentLocation(crate::types::error::InvalidContentLocation),
16    /// <p>The requested email is not eligible for update. This is usually the case for a redirected email.</p>
17    MessageFrozen(crate::types::error::MessageFrozen),
18    /// <p>The requested email could not be updated due to an error in the MIME content. Check the error message for more information about what caused the error.</p>
19    MessageRejected(crate::types::error::MessageRejected),
20    /// <p>The requested email message is not found.</p>
21    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
22    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
23    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
24    variable wildcard pattern and check `.code()`:
25     \
26    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
27     \
28    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
29    Unhandled(crate::error::sealed_unhandled::Unhandled),
30}
31impl ::std::fmt::Display for Error {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        match self {
34            Error::InvalidContentLocation(inner) => inner.fmt(f),
35            Error::MessageFrozen(inner) => inner.fmt(f),
36            Error::MessageRejected(inner) => inner.fmt(f),
37            Error::ResourceNotFoundException(inner) => inner.fmt(f),
38            Error::Unhandled(_) => {
39                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
40                    write!(f, "unhandled error ({code})")
41                } else {
42                    f.write_str("unhandled error")
43                }
44            }
45        }
46    }
47}
48impl From<::aws_smithy_types::error::operation::BuildError> for Error {
49    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
50        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
51            source: value.into(),
52            meta: ::std::default::Default::default(),
53        })
54    }
55}
56impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
57    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
58        match self {
59            Self::InvalidContentLocation(inner) => inner.meta(),
60            Self::MessageFrozen(inner) => inner.meta(),
61            Self::MessageRejected(inner) => inner.meta(),
62            Self::ResourceNotFoundException(inner) => inner.meta(),
63            Self::Unhandled(inner) => &inner.meta,
64        }
65    }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_raw_message_content::GetRawMessageContentError, R>> for Error
68where
69    R: Send + Sync + std::fmt::Debug + 'static,
70{
71    fn from(
72        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_raw_message_content::GetRawMessageContentError, R>,
73    ) -> Self {
74        match err {
75            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
76            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
77                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
78                source: err.into(),
79            }),
80        }
81    }
82}
83impl From<crate::operation::get_raw_message_content::GetRawMessageContentError> for Error {
84    fn from(err: crate::operation::get_raw_message_content::GetRawMessageContentError) -> Self {
85        match err {
86            crate::operation::get_raw_message_content::GetRawMessageContentError::ResourceNotFoundException(inner) => {
87                Error::ResourceNotFoundException(inner)
88            }
89            crate::operation::get_raw_message_content::GetRawMessageContentError::Unhandled(inner) => Error::Unhandled(inner),
90        }
91    }
92}
93impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_raw_message_content::PutRawMessageContentError, R>> for Error
94where
95    R: Send + Sync + std::fmt::Debug + 'static,
96{
97    fn from(
98        err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_raw_message_content::PutRawMessageContentError, R>,
99    ) -> Self {
100        match err {
101            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
102            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
103                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
104                source: err.into(),
105            }),
106        }
107    }
108}
109impl From<crate::operation::put_raw_message_content::PutRawMessageContentError> for Error {
110    fn from(err: crate::operation::put_raw_message_content::PutRawMessageContentError) -> Self {
111        match err {
112            crate::operation::put_raw_message_content::PutRawMessageContentError::InvalidContentLocation(inner) => {
113                Error::InvalidContentLocation(inner)
114            }
115            crate::operation::put_raw_message_content::PutRawMessageContentError::MessageFrozen(inner) => Error::MessageFrozen(inner),
116            crate::operation::put_raw_message_content::PutRawMessageContentError::MessageRejected(inner) => Error::MessageRejected(inner),
117            crate::operation::put_raw_message_content::PutRawMessageContentError::ResourceNotFoundException(inner) => {
118                Error::ResourceNotFoundException(inner)
119            }
120            crate::operation::put_raw_message_content::PutRawMessageContentError::Unhandled(inner) => Error::Unhandled(inner),
121        }
122    }
123}
124impl ::std::error::Error for Error {
125    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
126        match self {
127            Error::InvalidContentLocation(inner) => inner.source(),
128            Error::MessageFrozen(inner) => inner.source(),
129            Error::MessageRejected(inner) => inner.source(),
130            Error::ResourceNotFoundException(inner) => inner.source(),
131            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
132        }
133    }
134}
135impl ::aws_types::request_id::RequestId for Error {
136    fn request_id(&self) -> Option<&str> {
137        match self {
138            Self::InvalidContentLocation(e) => e.request_id(),
139            Self::MessageFrozen(e) => e.request_id(),
140            Self::MessageRejected(e) => e.request_id(),
141            Self::ResourceNotFoundException(e) => e.request_id(),
142            Self::Unhandled(e) => e.meta.request_id(),
143        }
144    }
145}