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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#[non_exhaustive]
#[derive(std::fmt::Debug)]
pub enum Error {
AccessDeniedException(crate::error::AccessDeniedException),
AuthorizationPendingException(crate::error::AuthorizationPendingException),
ExpiredTokenException(crate::error::ExpiredTokenException),
InternalServerException(crate::error::InternalServerException),
InvalidClientException(crate::error::InvalidClientException),
InvalidClientMetadataException(crate::error::InvalidClientMetadataException),
InvalidGrantException(crate::error::InvalidGrantException),
InvalidRequestException(crate::error::InvalidRequestException),
InvalidScopeException(crate::error::InvalidScopeException),
SlowDownException(crate::error::SlowDownException),
UnauthorizedClientException(crate::error::UnauthorizedClientException),
UnsupportedGrantTypeException(crate::error::UnsupportedGrantTypeException),
Unhandled(Box<dyn std::error::Error + Send + Sync + 'static>),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::AccessDeniedException(inner) => inner.fmt(f),
Error::AuthorizationPendingException(inner) => inner.fmt(f),
Error::ExpiredTokenException(inner) => inner.fmt(f),
Error::InternalServerException(inner) => inner.fmt(f),
Error::InvalidClientException(inner) => inner.fmt(f),
Error::InvalidClientMetadataException(inner) => inner.fmt(f),
Error::InvalidGrantException(inner) => inner.fmt(f),
Error::InvalidRequestException(inner) => inner.fmt(f),
Error::InvalidScopeException(inner) => inner.fmt(f),
Error::SlowDownException(inner) => inner.fmt(f),
Error::UnauthorizedClientException(inner) => inner.fmt(f),
Error::UnsupportedGrantTypeException(inner) => inner.fmt(f),
Error::Unhandled(inner) => inner.fmt(f),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::CreateTokenError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::CreateTokenError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::CreateTokenErrorKind::AccessDeniedException(inner) => {
Error::AccessDeniedException(inner)
}
crate::error::CreateTokenErrorKind::AuthorizationPendingException(inner) => {
Error::AuthorizationPendingException(inner)
}
crate::error::CreateTokenErrorKind::ExpiredTokenException(inner) => {
Error::ExpiredTokenException(inner)
}
crate::error::CreateTokenErrorKind::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::error::CreateTokenErrorKind::InvalidClientException(inner) => {
Error::InvalidClientException(inner)
}
crate::error::CreateTokenErrorKind::InvalidGrantException(inner) => {
Error::InvalidGrantException(inner)
}
crate::error::CreateTokenErrorKind::InvalidRequestException(inner) => {
Error::InvalidRequestException(inner)
}
crate::error::CreateTokenErrorKind::InvalidScopeException(inner) => {
Error::InvalidScopeException(inner)
}
crate::error::CreateTokenErrorKind::SlowDownException(inner) => {
Error::SlowDownException(inner)
}
crate::error::CreateTokenErrorKind::UnauthorizedClientException(inner) => {
Error::UnauthorizedClientException(inner)
}
crate::error::CreateTokenErrorKind::UnsupportedGrantTypeException(inner) => {
Error::UnsupportedGrantTypeException(inner)
}
crate::error::CreateTokenErrorKind::Unhandled(inner) => Error::Unhandled(inner),
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::RegisterClientError, R>> for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(err: aws_smithy_http::result::SdkError<crate::error::RegisterClientError, R>) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::RegisterClientErrorKind::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::error::RegisterClientErrorKind::InvalidClientMetadataException(inner) => {
Error::InvalidClientMetadataException(inner)
}
crate::error::RegisterClientErrorKind::InvalidRequestException(inner) => {
Error::InvalidRequestException(inner)
}
crate::error::RegisterClientErrorKind::InvalidScopeException(inner) => {
Error::InvalidScopeException(inner)
}
crate::error::RegisterClientErrorKind::Unhandled(inner) => Error::Unhandled(inner),
},
_ => Error::Unhandled(err.into()),
}
}
}
impl<R> From<aws_smithy_http::result::SdkError<crate::error::StartDeviceAuthorizationError, R>>
for Error
where
R: Send + Sync + std::fmt::Debug + 'static,
{
fn from(
err: aws_smithy_http::result::SdkError<crate::error::StartDeviceAuthorizationError, R>,
) -> Self {
match err {
aws_smithy_http::result::SdkError::ServiceError { err, .. } => match err.kind {
crate::error::StartDeviceAuthorizationErrorKind::InternalServerException(inner) => {
Error::InternalServerException(inner)
}
crate::error::StartDeviceAuthorizationErrorKind::InvalidClientException(inner) => {
Error::InvalidClientException(inner)
}
crate::error::StartDeviceAuthorizationErrorKind::InvalidRequestException(inner) => {
Error::InvalidRequestException(inner)
}
crate::error::StartDeviceAuthorizationErrorKind::SlowDownException(inner) => {
Error::SlowDownException(inner)
}
crate::error::StartDeviceAuthorizationErrorKind::UnauthorizedClientException(
inner,
) => Error::UnauthorizedClientException(inner),
crate::error::StartDeviceAuthorizationErrorKind::Unhandled(inner) => {
Error::Unhandled(inner)
}
},
_ => Error::Unhandled(err.into()),
}
}
}
impl std::error::Error for Error {}