use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ConfigError {
Environment(String),
ZeroValue(&'static str),
CapacityTooLarge,
UnrepresentableBudget(&'static str),
CleanupReserveExhaustsShutdown,
ConflictingListeners,
RemoteAdminRequiresOptIn,
}
impl fmt::Display for ConfigError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Environment(key) => {
write!(formatter, "unknown or invalid environment setting: {key}")
}
Self::CapacityTooLarge => {
formatter.write_str("max_in_flight exceeds the supported capacity")
}
Self::UnrepresentableBudget(field) => {
write!(formatter, "{field} cannot form a monotonic deadline")
}
Self::ZeroValue(field) => write!(formatter, "{field} must be greater than zero"),
Self::CleanupReserveExhaustsShutdown => {
formatter.write_str("cleanup_reserve must be less than shutdown_timeout")
}
Self::ConflictingListeners => {
formatter.write_str("application and administrative listeners must not overlap")
}
Self::RemoteAdminRequiresOptIn => {
formatter.write_str("a non-loopback admin_bind requires allow_remote_admin")
}
}
}
}
impl std::error::Error for ConfigError {}
#[cfg(test)]
#[path = "error_test.rs"]
mod error_test;