knowledge_runtime/
error.rs1#[derive(Debug, thiserror::Error)]
6pub enum RuntimeError {
7 #[error("memory store error: {0}")]
9 Memory(#[from] semantic_memory::MemoryError),
10
11 #[error("invalid config for '{field}': {reason}")]
13 InvalidConfig { field: &'static str, reason: String },
14
15 #[error("entity not found: {id}")]
17 EntityNotFound { id: String },
18
19 #[error("entity registry full (capacity {capacity})")]
21 RegistryFull { capacity: usize },
22
23 #[error("entity collision: name '{name}' already registered to {existing_id}, cannot assign to {new_id}")]
25 EntityCollision {
26 name: String,
27 existing_id: crate::ids::EntityId,
28 new_id: crate::ids::EntityId,
29 },
30
31 #[error("projection unavailable: {id} ({reason})")]
33 ProjectionUnavailable { id: String, reason: String },
34
35 #[error("adapter error: {0}")]
37 Adapter(String),
38
39 #[error("scope not fully enforced: upstream adapter only filters by namespace; unpushed dimensions: {unpushed_dimensions:?}")]
43 ScopeNotFullyEnforced {
44 unpushed_dimensions: Vec<String>,
46 },
47
48 #[error("temporal search not supported: results lack temporal metadata for expression '{temporal_expr}'")]
52 TemporalNotSupported {
53 temporal_expr: String,
55 },
56}
57
58impl RuntimeError {
59 pub fn kind(&self) -> &'static str {
61 match self {
62 Self::Memory(_) => "memory",
63 Self::InvalidConfig { .. } => "invalid_config",
64 Self::EntityNotFound { .. } => "entity_not_found",
65 Self::RegistryFull { .. } => "registry_full",
66 Self::ProjectionUnavailable { .. } => "projection_unavailable",
67 Self::Adapter(_) => "adapter",
68 Self::EntityCollision { .. } => "entity_collision",
69 Self::ScopeNotFullyEnforced { .. } => "scope_not_fully_enforced",
70 Self::TemporalNotSupported { .. } => "temporal_not_supported",
71 }
72 }
73}