googauth_lib/
errors.rs

1use thiserror::Error;
2use std::path::PathBuf;
3
4#[derive(Error, Debug)]
5pub enum LibError {
6    #[error("No such configuration: {0}")]
7    NoSuchConfiguration(String),
8    #[error("Can not find home directory")]
9    HomeDirectoryNotFound,
10    #[error("Configs directory {0} is not a directory")]
11    ConfigsDirectoryNotADirectory(PathBuf),
12    #[error("Error: {0}")]
13    IoError(#[from] std::io::Error),
14    #[error("Filename error")]
15    FilenameError,
16    #[error("JSON error {0:?}")]
17    JsonError(#[from] serde_json::Error),
18    #[error("URL parse error {0:?}")]
19    UrlError(#[from] url::ParseError),
20    #[error("The state sent to the server, and the state received from the server do not match - this may be a sign of a CSRF attack")]
21    TokenCsrfError,
22    #[error("No ID token present")]
23    NoIdToken,
24    #[error("No refresh token present")]
25    NoRefreshToken,
26    #[error("Could not refresh token")]
27    CouldNotRefreshToken,
28    #[error("Could not read claims")]
29    CouldNotReadClaims,
30    #[error("There were no scopes in the response")]
31    NoScopes,
32    #[error("Could not get a response from the login flow")]
33    NoResponse,
34    #[error("There is no refresh token available for configuration {0}")]
35    NoRefreshTokenForConfig(String),
36    #[error("Could not read access token from {0}. Is the configuration corrupt?")]
37    CouldNotReadConfigCorrupt(String),
38    #[error("OpenID error: {0}")]
39    OpenIdError(String),
40    #[error("No local port in redirect URL")]
41    NoRedirectPortError,
42}