aws_sdk_agentdiscovery/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 InternalServerException(crate::types::error::InternalServerException),
9 ThrottlingException(crate::types::error::ThrottlingException),
11 ValidationException(crate::types::error::ValidationException),
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::InternalServerException(inner) => inner.fmt(f),
27 Error::ThrottlingException(inner) => inner.fmt(f),
28 Error::ValidationException(inner) => inner.fmt(f),
29 Error::Unhandled(_) => {
30 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
31 write!(f, "unhandled error ({code})")
32 } else {
33 f.write_str("unhandled error")
34 }
35 }
36 }
37 }
38}
39impl From<::aws_smithy_types::error::operation::BuildError> for Error {
40 fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
41 Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
42 source: value.into(),
43 meta: ::std::default::Default::default(),
44 })
45 }
46}
47impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
48 fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
49 match self {
50 Self::InternalServerException(inner) => inner.meta(),
51 Self::ThrottlingException(inner) => inner.meta(),
52 Self::ValidationException(inner) => inner.meta(),
53 Self::Unhandled(inner) => &inner.meta,
54 }
55 }
56}
57impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::search_public_records::SearchPublicRecordsError, R>> for Error
58where
59 R: Send + Sync + std::fmt::Debug + 'static,
60{
61 fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::search_public_records::SearchPublicRecordsError, R>) -> 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::search_public_records::SearchPublicRecordsError> for Error {
72 fn from(err: crate::operation::search_public_records::SearchPublicRecordsError) -> Self {
73 match err {
74 crate::operation::search_public_records::SearchPublicRecordsError::InternalServerException(inner) => {
75 Error::InternalServerException(inner)
76 }
77 crate::operation::search_public_records::SearchPublicRecordsError::ThrottlingException(inner) => Error::ThrottlingException(inner),
78 crate::operation::search_public_records::SearchPublicRecordsError::ValidationException(inner) => Error::ValidationException(inner),
79 crate::operation::search_public_records::SearchPublicRecordsError::Unhandled(inner) => Error::Unhandled(inner),
80 }
81 }
82}
83impl ::std::error::Error for Error {
84 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
85 match self {
86 Error::InternalServerException(inner) => inner.source(),
87 Error::ThrottlingException(inner) => inner.source(),
88 Error::ValidationException(inner) => inner.source(),
89 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
90 }
91 }
92}
93impl ::aws_types::request_id::RequestId for Error {
94 fn request_id(&self) -> Option<&str> {
95 match self {
96 Self::InternalServerException(e) => e.request_id(),
97 Self::ThrottlingException(e) => e.request_id(),
98 Self::ValidationException(e) => e.request_id(),
99 Self::Unhandled(e) => e.meta.request_id(),
100 }
101 }
102}