aws_sdk_cloudtraildata/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 ChannelInsufficientPermission(crate::types::error::ChannelInsufficientPermission),
8 ChannelNotFound(crate::types::error::ChannelNotFound),
10 ChannelUnsupportedSchema(crate::types::error::ChannelUnsupportedSchema),
12 DuplicatedAuditEventId(crate::types::error::DuplicatedAuditEventId),
14 InvalidChannelArn(crate::types::error::InvalidChannelArn),
16 UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
18 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
20 variable wildcard pattern and check `.code()`:
21 \
22 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
23 \
24 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
25 Unhandled(crate::error::sealed_unhandled::Unhandled),
26}
27impl ::std::fmt::Display for Error {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 match self {
30 Error::ChannelInsufficientPermission(inner) => inner.fmt(f),
31 Error::ChannelNotFound(inner) => inner.fmt(f),
32 Error::ChannelUnsupportedSchema(inner) => inner.fmt(f),
33 Error::DuplicatedAuditEventId(inner) => inner.fmt(f),
34 Error::InvalidChannelArn(inner) => inner.fmt(f),
35 Error::UnsupportedOperationException(inner) => inner.fmt(f),
36 Error::Unhandled(_) => {
37 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
38 write!(f, "unhandled error ({code})")
39 } else {
40 f.write_str("unhandled error")
41 }
42 }
43 }
44 }
45}
46impl From<::aws_smithy_types::error::operation::BuildError> for Error {
47 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
48 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
49 source: value.into(),
50 meta: ::std::default::Default::default(),
51 })
52 }
53}
54impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
55 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
56 match self {
57 Self::ChannelInsufficientPermission(inner) => inner.meta(),
58 Self::ChannelNotFound(inner) => inner.meta(),
59 Self::ChannelUnsupportedSchema(inner) => inner.meta(),
60 Self::DuplicatedAuditEventId(inner) => inner.meta(),
61 Self::InvalidChannelArn(inner) => inner.meta(),
62 Self::UnsupportedOperationException(inner) => inner.meta(),
63 Self::Unhandled(inner) => &inner.meta,
64 }
65 }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_audit_events::PutAuditEventsError, R>> for Error
68where
69 R: Send + Sync + std::fmt::Debug + 'static,
70{
71 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_audit_events::PutAuditEventsError, R>) -> Self {
72 match err {
73 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
74 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
75 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
76 source: err.into(),
77 }),
78 }
79 }
80}
81impl From<crate::operation::put_audit_events::PutAuditEventsError> for Error {
82 fn from(err: crate::operation::put_audit_events::PutAuditEventsError) -> Self {
83 match err {
84 crate::operation::put_audit_events::PutAuditEventsError::ChannelInsufficientPermission(inner) => {
85 Error::ChannelInsufficientPermission(inner)
86 }
87 crate::operation::put_audit_events::PutAuditEventsError::ChannelNotFound(inner) => Error::ChannelNotFound(inner),
88 crate::operation::put_audit_events::PutAuditEventsError::ChannelUnsupportedSchema(inner) => Error::ChannelUnsupportedSchema(inner),
89 crate::operation::put_audit_events::PutAuditEventsError::DuplicatedAuditEventId(inner) => Error::DuplicatedAuditEventId(inner),
90 crate::operation::put_audit_events::PutAuditEventsError::InvalidChannelArn(inner) => Error::InvalidChannelArn(inner),
91 crate::operation::put_audit_events::PutAuditEventsError::UnsupportedOperationException(inner) => {
92 Error::UnsupportedOperationException(inner)
93 }
94 crate::operation::put_audit_events::PutAuditEventsError::Unhandled(inner) => Error::Unhandled(inner),
95 }
96 }
97}
98impl ::std::error::Error for Error {
99 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
100 match self {
101 Error::ChannelInsufficientPermission(inner) => inner.source(),
102 Error::ChannelNotFound(inner) => inner.source(),
103 Error::ChannelUnsupportedSchema(inner) => inner.source(),
104 Error::DuplicatedAuditEventId(inner) => inner.source(),
105 Error::InvalidChannelArn(inner) => inner.source(),
106 Error::UnsupportedOperationException(inner) => inner.source(),
107 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
108 }
109 }
110}
111impl ::aws_types::request_id::RequestId for Error {
112 fn request_id(&self) -> Option<&str> {
113 match self {
114 Self::ChannelInsufficientPermission(e) => e.request_id(),
115 Self::ChannelNotFound(e) => e.request_id(),
116 Self::ChannelUnsupportedSchema(e) => e.request_id(),
117 Self::DuplicatedAuditEventId(e) => e.request_id(),
118 Self::InvalidChannelArn(e) => e.request_id(),
119 Self::UnsupportedOperationException(e) => e.request_id(),
120 Self::Unhandled(e) => e.meta.request_id(),
121 }
122 }
123}