Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
37 lines
1.4 KiB
Rust
37 lines
1.4 KiB
Rust
//! `ApplyError` — structured failure reasons for `apply()`.
|
|
//!
|
|
//! Kept in its own module so `apply.rs` stays focused on the algorithm
|
|
//! and each file stays within Constructor Pattern limits.
|
|
|
|
use std::fmt;
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub enum ApplyError {
|
|
InvalidPointer(String),
|
|
MissingParent(String),
|
|
MissingTarget(String),
|
|
IndexOutOfBounds { path: String, index: usize, len: usize },
|
|
TypeMismatch { path: String, expected: &'static str },
|
|
CannotAddToRoot,
|
|
CannotRemoveRoot,
|
|
}
|
|
|
|
impl fmt::Display for ApplyError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
Self::InvalidPointer(p) => write!(f, "invalid JSON pointer: {p:?}"),
|
|
Self::MissingParent(p) => write!(f, "missing parent at {p:?}"),
|
|
Self::MissingTarget(p) => write!(f, "missing target at {p:?}"),
|
|
Self::IndexOutOfBounds { path, index, len } => {
|
|
write!(f, "index {index} out of bounds (len {len}) at {path:?}")
|
|
}
|
|
Self::TypeMismatch { path, expected } => {
|
|
write!(f, "type mismatch at {path:?}: expected {expected}")
|
|
}
|
|
Self::CannotAddToRoot => write!(f, "cannot 'add' to root (use 'replace')"),
|
|
Self::CannotRemoveRoot => write!(f, "cannot 'remove' root"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for ApplyError {}
|