use crate::KernelPhase;
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
pub enum KernelError {
#[error("unknown environment `{0}` (use `dev`, `test`, `prod`, or a non-empty custom name)")]
UnknownEnvironment(String),
#[error("cannot `{action}` while kernel is in phase `{state}`")]
InvalidState {
action: &'static str,
state: KernelPhase,
},
#[error("bundle `{0}` is already registered")]
DuplicateBundle(&'static str),
#[error("bundle `{bundle}` depends on unknown bundle `{dependency}`")]
UnknownBundleDependency {
bundle: &'static str,
dependency: &'static str,
},
#[error("cyclic bundle dependency involving `{0}`")]
CyclicBundleDependency(&'static str),
#[error("bundle `{bundle}` failed during {phase}: {message}")]
Bundle {
bundle: &'static str,
phase: &'static str,
message: String,
},
}