aws_sdk_qldbsession/
error_meta.rs1#[non_exhaustive]
4#[derive(::std::fmt::Debug)]
5pub enum Error {
6 BadRequestException(crate::types::error::BadRequestException),
8 CapacityExceededException(crate::types::error::CapacityExceededException),
10 InvalidSessionException(crate::types::error::InvalidSessionException),
12 LimitExceededException(crate::types::error::LimitExceededException),
14 OccConflictException(crate::types::error::OccConflictException),
16 RateExceededException(crate::types::error::RateExceededException),
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::BadRequestException(inner) => inner.fmt(f),
31 Error::CapacityExceededException(inner) => inner.fmt(f),
32 Error::InvalidSessionException(inner) => inner.fmt(f),
33 Error::LimitExceededException(inner) => inner.fmt(f),
34 Error::OccConflictException(inner) => inner.fmt(f),
35 Error::RateExceededException(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::BadRequestException(inner) => inner.meta(),
58 Self::CapacityExceededException(inner) => inner.meta(),
59 Self::InvalidSessionException(inner) => inner.meta(),
60 Self::LimitExceededException(inner) => inner.meta(),
61 Self::OccConflictException(inner) => inner.meta(),
62 Self::RateExceededException(inner) => inner.meta(),
63 Self::Unhandled(inner) => &inner.meta,
64 }
65 }
66}
67impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_command::SendCommandError, 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::send_command::SendCommandError, 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::send_command::SendCommandError> for Error {
82 fn from(err: crate::operation::send_command::SendCommandError) -> Self {
83 match err {
84 crate::operation::send_command::SendCommandError::BadRequestException(inner) => Error::BadRequestException(inner),
85 crate::operation::send_command::SendCommandError::CapacityExceededException(inner) => Error::CapacityExceededException(inner),
86 crate::operation::send_command::SendCommandError::InvalidSessionException(inner) => Error::InvalidSessionException(inner),
87 crate::operation::send_command::SendCommandError::LimitExceededException(inner) => Error::LimitExceededException(inner),
88 crate::operation::send_command::SendCommandError::OccConflictException(inner) => Error::OccConflictException(inner),
89 crate::operation::send_command::SendCommandError::RateExceededException(inner) => Error::RateExceededException(inner),
90 crate::operation::send_command::SendCommandError::Unhandled(inner) => Error::Unhandled(inner),
91 }
92 }
93}
94impl ::std::error::Error for Error {
95 fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
96 match self {
97 Error::BadRequestException(inner) => inner.source(),
98 Error::CapacityExceededException(inner) => inner.source(),
99 Error::InvalidSessionException(inner) => inner.source(),
100 Error::LimitExceededException(inner) => inner.source(),
101 Error::OccConflictException(inner) => inner.source(),
102 Error::RateExceededException(inner) => inner.source(),
103 Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
104 }
105 }
106}
107impl ::aws_types::request_id::RequestId for Error {
108 fn request_id(&self) -> Option<&str> {
109 match self {
110 Self::BadRequestException(e) => e.request_id(),
111 Self::CapacityExceededException(e) => e.request_id(),
112 Self::InvalidSessionException(e) => e.request_id(),
113 Self::LimitExceededException(e) => e.request_id(),
114 Self::OccConflictException(e) => e.request_id(),
115 Self::RateExceededException(e) => e.request_id(),
116 Self::Unhandled(e) => e.meta.request_id(),
117 }
118 }
119}