trait_kit/kit/error.rs
1// Copyright © 2026 Kirky.X. All rights reserved.
2
3//! Kit error types.
4
5use std::error::Error;
6
7/// The error type for Kit operations.
8///
9/// All Kit operations return `Result<T, KitError>`.
10#[derive(Debug, thiserror::Error)]
11pub enum KitError {
12 /// Build failed for a module.
13 #[error("failed to build module `{module}`")]
14 BuildFailed {
15 /// The module name (`Module::NAME`).
16 module: &'static str,
17 /// The original build error.
18 #[source]
19 source: Box<dyn Error + Send + Sync>,
20 },
21
22 /// Required capability is missing from Kit.
23 #[error("missing capability `{key}`")]
24 MissingCapability {
25 /// The capability key name (`CapabilityKey::NAME`).
26 key: &'static str,
27 },
28
29 /// Capability already exists in Kit (duplicate registration).
30 #[error("capability `{key}` already exists")]
31 DuplicateCapability {
32 /// The capability key name (`CapabilityKey::NAME`).
33 key: &'static str,
34 },
35
36 /// Required configuration is missing from Kit.
37 #[error("missing config `{key}`")]
38 MissingConfig {
39 /// The config key name (`ConfigKey::NAME`).
40 key: &'static str,
41 },
42}