use thiserror::Error;
pub use crate::oauth2::error::OAuthError;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
ConfigError(ConfigError),
#[error(transparent)]
OAuthError(OAuthError),
#[error(transparent)]
ReqwestError(#[from] reqwest::Error),
#[error(transparent)]
UrlParseError(#[from] url::ParseError),
#[error(transparent)]
SerdeJsonError(#[from] serde_json::Error),
}
#[derive(Error, Debug)]
pub enum ConfigError {
#[error(
"Missing ESI client ID.\n\
\n\
To fix this:\n\
- Set `esi_client_builder.client_id(client_id)`\n\
- You can obtain a client ID at:\n\
https://developers.eveonline.com/applications\n\
\n\
This is required for accessing EVE Online OAuth2."
)]
MissingClientId,
#[error(
"Missing ESI client secret.\n\
\n\
To fix this:\n\
- Set `esi_client_builder.client_secret(client_secret)`\n\
- You can obtain a client secret at:\n\
https://developers.eveonline.com/applications\n\
\n\
This is required for accessing EVE Online OAuth2."
)]
MissingClientSecret,
#[error(
"Missing ESI callback URL.\n\
\n\
To fix this:\n\
- Set `esi_client_builder.callback_url(callback_url)`\n\
- Ensure it matches the callback URL set at:\n\
https://developers.eveonline.com/applications\n\
\n\
This is required for accessing EVE Online OAuth2."
)]
MissingCallbackUrl,
#[error(
"Invalid EVE OAuth2 callback URL:\n\
\n\
To fix this:\n\
- Use the default URL provided by the Client\n\
- Validate the url set using `esi_client_builder.callback_url(callback_url)`\n\
is using a url that is correctly formatted\n\
e.g. https://example.com/callback\n\
\n\
This is required for accessing EVE Online OAuth2."
)]
InvalidCallbackUrl,
#[error(
"Invalid EVE OAuth2 URL:\n\
\n\
To fix this:\n\
- Use the default URL provided by the default config\n\
- Validate the url set using [`super::OAuth2Config`]\n\
is using a url that is correctly formatted\n\
e.g. https://login.eveonline.com/v2/oauth/authorize"
)]
InvalidAuthUrl,
#[error(
"Invalid EVE OAuth2 token URL:\n\
\n\
To fix this:\n\
- Use the default URL provided by the default config\n\
- Validate the url set using [`super::OAuth2Config`]\n\
is using a url that is correctly formatted\n\
e.g. https://login.eveonline.com/v2/oauth/token"
)]
InvalidTokenUrl,
#[error(
"Invalid JWT key cache background refresh threshold:\n\
\n\
To fix this:\n\
- Use the default percentage provided by the default config\n\
- Validate the percentage set using [`super::OAuth2Config`]
is between 0 and 100."
)]
InvalidBackgroundRefreshThreshold,
}