use thiserror::Error;
#[derive(Debug, Error)]
pub enum KernelError {
#[error("module error: {0}")]
Module(String),
#[error("bus error: {0}")]
Bus(String),
#[error("registry error: {0}")]
Registry(#[from] sqlx::Error),
#[error("configuration key not found: {0}")]
ConfigNotFound(String),
#[error("module already registered: {0}")]
DuplicateModule(String),
#[error("unknown module: {0}")]
UnknownModule(String),
#[error("serialization error: {0}")]
Serde(#[from] serde_json::Error),
#[error("access denied: `{publisher}` lacks capability `{capability}`")]
Denied {
publisher: String,
capability: String,
},
#[error(transparent)]
Other(#[from] anyhow::Error),
}
pub type Result<T> = std::result::Result<T, KernelError>;