cobble_core/error/
auth_error.rs1pub type AuthResult<T> = Result<T, AuthError>;
3
4#[derive(Debug, thiserror::Error)]
6pub enum AuthError {
7 #[error("Failed to parse an URL")]
9 ParseUrl(oauth2::url::ParseError),
10 #[error("There was a problem configuring the request: {0}")]
12 ConfigurationError(oauth2::ConfigurationError),
13 #[error("Error while requesting access token: {0}")]
15 RequestTokenError(String),
16 #[error("Microsoft did not provide a refresh token")]
18 NoRefreshToken,
19 #[error("{0}")]
21 Request(reqwest::Error),
22 #[error("XBoxLive auth did not return a user hash")]
24 NoXblUserHash,
25 #[error("User is missing entitlements")]
27 Unauthorized,
28}
29
30impl From<oauth2::url::ParseError> for AuthError {
31 fn from(err: oauth2::url::ParseError) -> Self {
32 Self::ParseUrl(err)
33 }
34}
35
36impl From<oauth2::ConfigurationError> for AuthError {
37 fn from(err: oauth2::ConfigurationError) -> Self {
38 Self::ConfigurationError(err)
39 }
40}
41
42impl From<reqwest::Error> for AuthError {
43 fn from(err: reqwest::Error) -> Self {
44 Self::Request(err)
45 }
46}