hive_client/client/authentication/
error.rs1use crate::client::authentication::ChallengeRequest;
2use aws_cognito_srp::SrpError;
3use aws_sdk_cognitoidentityprovider::error::SdkError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7#[error(transparent)]
8#[non_exhaustive]
9pub enum AuthenticationError {
11 #[error("The session token was not found in the response")]
12 InvalidAccessToken,
14
15 #[error("The presented challenge is not supported. Challenge was: {0}")]
16 UnsupportedChallenge(String),
18
19 #[error(transparent)]
20 LoginFailed(
22 #[from]
23 SdkError<aws_sdk_cognitoidentityprovider::operation::initiate_auth::InitiateAuthError>,
24 ),
25
26 #[error(transparent)]
27 ChallengeFailed(
29 #[from]
30 SdkError<aws_sdk_cognitoidentityprovider::operation::respond_to_auth_challenge::RespondToAuthChallengeError>,
31 ),
32
33 #[error("The challenge was not handled correctly")]
34 MissingChallengeParameter(String),
36
37 #[error("An error occurred while trying to authenticate the user")]
38 SrpFailed(
40 #[from]
41 SrpError,
42 ),
43
44 #[error("A challenge was requested")]
45 NextChallenge(ChallengeRequest),
49
50 DeviceConfirmationError(
52 #[from]
53 DeviceConfirmationError
54 ),
55
56 #[error("There is currently no valid authentication in progress")]
57 NoAuthenticationInProgress,
59}
60
61#[derive(Error, Debug)]
62#[error(transparent)]
63pub enum RefreshError {
65 #[error(
66 "The request to refresh the authentication tokens failed as the access token could not be validated"
67 )]
68 InvalidAccessToken,
71
72 #[error("The request to refresh the authentication tokens failed")]
73 RequestFailed(String),
75
76 #[error("There is currently no valid authentication in progress")]
77 NotLoggedIn,
79}
80
81#[derive(Error, Debug)]
82#[error(transparent)]
83pub enum DeviceConfirmationError {
86 #[error(transparent)]
87 ConfirmationFailed(
89 #[from]
90 SdkError<aws_sdk_cognitoidentityprovider::operation::confirm_device::ConfirmDeviceError>,
91 ),
92
93 #[error(transparent)]
94 StatusUpdateFailed(
96 #[from]
97 SdkError<aws_sdk_cognitoidentityprovider::operation::update_device_status::UpdateDeviceStatusError>,
98 ),
99
100 #[error("The device being confirmed is already tracked")]
101 DeviceAlreadyTracked,
103}