Skip to main content

chuoku/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Error, Debug)]
6pub enum Error {
7    #[error("AssumeRole request error {0:?}")]
8    AssumeRoleError(#[from] rusoto_core::RusotoError<rusoto_sts::AssumeRoleError>),
9
10    #[error("GetSessionToken request error {0:?}")]
11    GetSessionTokenError(#[from] rusoto_core::RusotoError<rusoto_sts::GetSessionTokenError>),
12
13    #[error("Profile {0:?} is not for crate session nor assume role")]
14    ProfileNotForSignIn(String),
15
16    #[error("Profile {0:?} is not signed in.")]
17    ProfileNotSignedIn(String),
18
19    #[error("Request get session token error {0:?}")]
20    RusotoTlsError(#[from] rusoto_core::request::TlsError),
21
22    #[error("rusoto credentials error {0:?}")]
23    RusotoCredentialsError(#[from] rusoto_credential::CredentialsError),
24
25    #[error("Profile {0} is not found.")]
26    ProfileNotFound(String),
27
28    #[error("Profile {0} is not for {1}.")]
29    ProfileTypeError(String, String),
30
31    #[error("Profile {0} does not have value of {1}.")]
32    ProfileParamNotFound(String, String),
33
34    #[error("profile {0} is not for assume role.")]
35    AssumeRoleSettingNotFound(String),
36
37    #[error("Config file error. {0:?}")]
38    ConfigFileError(String),
39
40    #[error("Credential file error. {0:?}")]
41    CredentialFileError(String),
42
43    #[error("Ngydv config file error. {0:?}")]
44    NgydvConfigError(String),
45
46    #[error("AWS response format error. {0:?}")]
47    AwsResponseFormatError(String),
48
49    #[error("User home not found.")]
50    UserHomeNotFoundError,
51
52    #[error("Unable to write credentail file at {0:?}.")]
53    UnableToWriteCredentialFileError(String),
54
55    #[error("Unable to remove credentail file at {0:?}.")]
56    UnableToRemoveCredentialFileError(String),
57
58    #[error("Session expired at {0:?}.")]
59    SessionExpiredError(String),
60}