Files
notescraft/crates/knowledge/src/error.rs
T
Marcos Paulo 15d7f5e873 feat: editor blocks and lint, vault knowledge, calendar plugin, macOS menu
- notescraft-lint (rules, safe fixes, learned style) and notescraft-blocks (block model and edits); engine lint.* and block.* commands with CLI and MCP parity
- Lint tab, underlines, slash menu with preview in Source and Visual, block grip and menu, Settings > Editor and lint, Vim block keys
- Visual view: tables, note embeds, %% comments, wrapping property chips
- Vault knowledge (Related tab, assistant sources, Settings) and calendar plugin
- Sidebar top padding fixed, dot grid follows PaperCraft spacing, right-card tabs no longer cover the collapse button

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 12:36:00 -03:00

54 lines
1.8 KiB
Rust

//! Errors of the knowledge crate.
/// Everything that can go wrong chunking, indexing or searching.
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum Error {
/// The note is bigger than [`crate::caps::MAX_NOTE_BYTES`].
#[error("note of {len} bytes exceeds the {max} byte limit")]
NoteTooLarge {
/// Note size, in bytes.
len: usize,
/// The limit, in bytes.
max: usize,
},
/// Indexing the note would pass [`crate::caps::MAX_TOTAL_PASSAGES`].
#[error("the index is full ({max} passages)")]
IndexFull {
/// The limit, in passages.
max: usize,
},
/// A query has more terms than [`crate::caps::MAX_QUERY_TERMS`].
#[error("query has {count} terms, the limit is {max}")]
TooManyTerms {
/// Terms given.
count: usize,
/// The limit.
max: usize,
},
/// The path is empty or longer than [`crate::caps::MAX_PATH_BYTES`].
#[error("invalid note path")]
InvalidPath,
/// The path is in an excluded or reserved folder.
#[error("path is excluded from the knowledge index: {0}")]
Excluded(String),
/// A serialized vocabulary is malformed or over its size limit.
#[error("invalid vocabulary cache: {0}")]
InvalidCache(String),
/// A byte range is outside the content or reversed.
#[error("range {start}..{end} is outside content of {len} bytes")]
InvalidRange {
/// Range start, in bytes.
start: usize,
/// Range end, in bytes.
end: usize,
/// Content length, in bytes.
len: usize,
},
/// A byte range starts or ends inside a `char`.
#[error("range starts or ends inside a char")]
NotCharBoundary,
}
/// Result type of the knowledge crate.
pub type Result<T> = std::result::Result<T, Error>;