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 AccessTokenNotValid,
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("The API call failed as the authentication could not be refreshed")]
57 AuthenticationRefreshFailed,
59
60 #[error("There is currently no valid authentication in progress")]
61 NoAuthenticationInProgress,
63
64 #[error("Unable to continue with the authentication flow as the user is not logged in")]
65 NotLoggedIn,
67
68 #[error("The device has already been confirmed")]
69 DeviceAlreadyTrusted,
71}
72
73#[derive(Error, Debug)]
74#[error(transparent)]
75pub enum DeviceConfirmationError {
78 #[error(transparent)]
79 ConfirmationFailed(
81 #[from]
82 SdkError<aws_sdk_cognitoidentityprovider::operation::confirm_device::ConfirmDeviceError>,
83 ),
84
85 #[error(transparent)]
86 StatusUpdateFailed(
88 #[from]
89 SdkError<aws_sdk_cognitoidentityprovider::operation::update_device_status::UpdateDeviceStatusError>,
90 ),
91
92 #[error("The device being confirmed is already tracked")]
93 DeviceAlreadyTracked,
95}