1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum Error {
BadRequestException(crate::error::BadRequestException),
CapacityExceededException(crate::error::CapacityExceededException),
InvalidSessionException(crate::error::InvalidSessionException),
LimitExceededException(crate::error::LimitExceededException),
OccConflictException(crate::error::OccConflictException),
RateExceededException(crate::error::RateExceededException),
Unhandled(crate::error::Unhandled),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::BadRequestException(inner) => inner.fmt(f),
Error::CapacityExceededException(inner) => inner.fmt(f),
Error::InvalidSessionException(inner) => inner.fmt(f),
Error::LimitExceededException(inner) => inner.fmt(f),
Error::OccConflictException(inner) => inner.fmt(f),
Error::RateExceededException(inner) => inner.fmt(f),
Error::Unhandled(inner) => inner.fmt(f),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::SendCommandError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::SendCommandError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError(context) => {
Self::from(context.into_err())
}
_ => Error::Unhandled(crate::error::Unhandled::new(err.into())),
}
}
}
impl From<crate::error::SendCommandError> for Error {
fn from(err: crate::error::SendCommandError) -> Self {
match err.kind {
crate::error::SendCommandErrorKind::BadRequestException(inner) => {
Error::BadRequestException(inner)
}
crate::error::SendCommandErrorKind::CapacityExceededException(inner) => {
Error::CapacityExceededException(inner)
}
crate::error::SendCommandErrorKind::InvalidSessionException(inner) => {
Error::InvalidSessionException(inner)
}
crate::error::SendCommandErrorKind::LimitExceededException(inner) => {
Error::LimitExceededException(inner)
}
crate::error::SendCommandErrorKind::OccConflictException(inner) => {
Error::OccConflictException(inner)
}
crate::error::SendCommandErrorKind::RateExceededException(inner) => {
Error::RateExceededException(inner)
}
crate::error::SendCommandErrorKind::Unhandled(inner) => {
Error::Unhandled(crate::error::Unhandled::new(inner.into()))
}
}
}
}
impl std::error::Error for Error {}