#[derive(Debug, thiserror::Error)]
pub enum EggressError {
#[error("config error: {0}")]
Config(String),
#[error("runtime error: {0}")]
Runtime(String),
#[error("startup error: {0}")]
Startup(String),
#[error("reload error: {0}")]
Reload(String),
#[error("shutdown error: {0}")]
Shutdown(String),
#[error("unsupported feature: {feature}: {message}")]
UnsupportedFeature {
feature: String,
message: String,
},
#[error("internal error: {0}")]
Internal(String),
}
impl EggressError {
pub fn category(&self) -> &'static str {
match self {
EggressError::Config(_) => "config",
EggressError::Runtime(_) => "runtime",
EggressError::Startup(_) => "startup",
EggressError::Reload(_) => "reload",
EggressError::Shutdown(_) => "shutdown",
EggressError::UnsupportedFeature { .. } => "unsupported_feature",
EggressError::Internal(_) => "internal",
}
}
}