aws_sdk_apigatewaymanagement/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 ForbiddenException(crate::types::error::ForbiddenException),
8 GoneException(crate::types::error::GoneException),
10 LimitExceededException(crate::types::error::LimitExceededException),
12 PayloadTooLargeException(crate::types::error::PayloadTooLargeException),
14 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
16 variable wildcard pattern and check `.code()`:
17 \
18 `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::ForbiddenException(inner) => inner.fmt(f),
27 Error::GoneException(inner) => inner.fmt(f),
28 Error::LimitExceededException(inner) => inner.fmt(f),
29 Error::PayloadTooLargeException(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::ForbiddenException(inner) => inner.meta(),
52 Self::GoneException(inner) => inner.meta(),
53 Self::LimitExceededException(inner) => inner.meta(),
54 Self::PayloadTooLargeException(inner) => inner.meta(),
55 Self::Unhandled(inner) => &inner.meta,
56 }
57 }
58}
59impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::delete_connection::DeleteConnectionError, 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::delete_connection::DeleteConnectionError, 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::delete_connection::DeleteConnectionError> for Error {
74 fn from(err: crate::operation::delete_connection::DeleteConnectionError) -> Self {
75 match err {
76 crate::operation::delete_connection::DeleteConnectionError::ForbiddenException(inner) => Error::ForbiddenException(inner),
77 crate::operation::delete_connection::DeleteConnectionError::GoneException(inner) => Error::GoneException(inner),
78 crate::operation::delete_connection::DeleteConnectionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
79 crate::operation::delete_connection::DeleteConnectionError::Unhandled(inner) => Error::Unhandled(inner),
80 }
81 }
82}
83impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_connection::GetConnectionError, R>> for Error
84where
85 R: Send + Sync + std::fmt::Debug + 'static,
86{
87 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_connection::GetConnectionError, R>) -> Self {
88 match err {
89 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
90 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
91 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
92 source: err.into(),
93 }),
94 }
95 }
96}
97impl From<crate::operation::get_connection::GetConnectionError> for Error {
98 fn from(err: crate::operation::get_connection::GetConnectionError) -> Self {
99 match err {
100 crate::operation::get_connection::GetConnectionError::ForbiddenException(inner) => Error::ForbiddenException(inner),
101 crate::operation::get_connection::GetConnectionError::GoneException(inner) => Error::GoneException(inner),
102 crate::operation::get_connection::GetConnectionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
103 crate::operation::get_connection::GetConnectionError::Unhandled(inner) => Error::Unhandled(inner),
104 }
105 }
106}
107impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_to_connection::PostToConnectionError, R>> for Error
108where
109 R: Send + Sync + std::fmt::Debug + 'static,
110{
111 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::post_to_connection::PostToConnectionError, R>) -> Self {
112 match err {
113 ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
114 _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
115 meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
116 source: err.into(),
117 }),
118 }
119 }
120}
121impl From<crate::operation::post_to_connection::PostToConnectionError> for Error {
122 fn from(err: crate::operation::post_to_connection::PostToConnectionError) -> Self {
123 match err {
124 crate::operation::post_to_connection::PostToConnectionError::ForbiddenException(inner) => Error::ForbiddenException(inner),
125 crate::operation::post_to_connection::PostToConnectionError::GoneException(inner) => Error::GoneException(inner),
126 crate::operation::post_to_connection::PostToConnectionError::LimitExceededException(inner) => Error::LimitExceededException(inner),
127 crate::operation::post_to_connection::PostToConnectionError::PayloadTooLargeException(inner) => Error::PayloadTooLargeException(inner),
128 crate::operation::post_to_connection::PostToConnectionError::Unhandled(inner) => Error::Unhandled(inner),
129 }
130 }
131}
132impl ::std::error::Error for Error {
133 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
134 match self {
135 Error::ForbiddenException(inner) => inner.source(),
136 Error::GoneException(inner) => inner.source(),
137 Error::LimitExceededException(inner) => inner.source(),
138 Error::PayloadTooLargeException(inner) => inner.source(),
139 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
140 }
141 }
142}
143impl ::aws_types::request_id::RequestId for Error {
144 fn request_id(&self) -> Option<&str> {
145 match self {
146 Self::ForbiddenException(e) => e.request_id(),
147 Self::GoneException(e) => e.request_id(),
148 Self::LimitExceededException(e) => e.request_id(),
149 Self::PayloadTooLargeException(e) => e.request_id(),
150 Self::Unhandled(e) => e.meta.request_id(),
151 }
152 }
153}