use std::io;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("failed to load .env file: {0}")]
Dotenv(#[from] dotenvy::Error),
#[error("invalid value {value:?} for environment variable {key}: {reason}")]
InvalidEnv {
key: String,
value: String,
reason: String,
},
#[error("failed to initialize logging: {0}")]
Logging(String),
#[error("failed to bind to {addr}: {source}")]
Bind {
addr: String,
#[source]
source: io::Error,
},
#[error("server error: {0}")]
Server(#[source] io::Error),
#[cfg(feature = "oidc")]
#[error("{0} is not set. {hint}", hint = crate::oidc::SETUP_HINT)]
MissingOidcSetting(&'static str),
#[cfg(feature = "oidc")]
#[error("OpenID Connect: {0}")]
Oidc(String),
#[cfg(feature = "database")]
#[error("database error: {0}")]
Database(#[from] toasty::Error),
#[cfg(feature = "database")]
#[error("cannot create the database directory: {0}")]
DatabaseDir(#[source] io::Error),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;