hephaestus/crates/heph-core/src/error.rs
Erich Blume a5fc578525
Some checks failed
Build / validate (pull_request) Failing after 18m44s
feat(views): filter views (§8.2) — saved agenda slices
Make the owner's saved filters first-class so the agenda isn't one flat
list. `list` now takes a ListFilter predicate-as-data (heph-core::filter):
attention include/exclude sets, project-id scope, exclude_projects, and an
actionable do-date gate. New Store::view(name) resolves a built-in ViewSpec
— looking project names up to ids and subtree-expanding them through parent
links — then lists.

Five built-ins seeded from the Todoist queries (design §6.2.1): tom, ondeck,
chores, work, tasks (Schedule dropped — time-of-day isn't modeled on
date-grained do-dates). Surfaced as `heph view <name>` (no name lists them),
the `view` RPC + RemoteStore forward, and `:Heph view <name>` in nvim.

The list RPC/RemoteStore/CLI/heph.nvim migrate to the filter wire; legacy
--scope/--attention/--no-blue map onto it (nvim view.lua updated).

Tests: filter unit predicate, a views integration suite (subtree
scope+exclude, actionable gate, unknown-view error, absent-project empties),
a socket list/view dispatch test, two nvim e2e specs. 154 Rust tests + 18
nvim e2e green; clippy/fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 06:39:07 -07:00

37 lines
1.1 KiB
Rust

//! Error type for `heph-core`.
/// Errors surfaced by the core library.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// A SQLite-level failure.
#[error("sqlite: {0}")]
Sqlite(#[from] rusqlite::Error),
/// A filesystem failure (e.g. during `export`).
#[error("io: {0}")]
Io(#[from] std::io::Error),
/// The DB file is already locked by another `local`/`server` process.
#[error("store is already locked by another process: {0}")]
Locked(String),
/// A referenced node does not exist.
#[error("node not found: {0}")]
NodeNotFound(String),
/// A value in the database did not match the expected shape.
#[error("data integrity: {0}")]
Integrity(String),
/// A caller passed an invalid argument (e.g. an unknown filter-view name).
#[error("invalid argument: {0}")]
InvalidArg(String),
/// A remote backend (a `RemoteStore` in `client` mode) failed or returned an
/// error response (tech-spec §3.1).
#[error("remote: {0}")]
Remote(String),
}
/// Convenience result alias.
pub type Result<T> = std::result::Result<T, Error>;