Skip to main content

rinne_core/
error.rs

1//! Shared error and result types used across the Rinne library crates.
2//!
3//! Library crates surface `RinneError` (via `thiserror`); the binary boundary
4//! (`rinne-cli`) wraps these in `anyhow` for top-level reporting.
5
6use std::path::PathBuf;
7
8/// The canonical error type for Rinne's library crates.
9#[derive(Debug, thiserror::Error)]
10pub enum RinneError {
11    #[error("configuration error: {0}")]
12    Config(String),
13
14    #[error("worker error: {0}")]
15    Worker(String),
16
17    #[error("conductor error: {0}")]
18    Conductor(String),
19
20    #[error("blackboard error: {0}")]
21    Blackboard(String),
22
23    #[error("plan/DAG error: {0}")]
24    Plan(String),
25
26    /// A run was cancelled (e.g. via `/pause`, a budget kill, or a
27    /// stuck-detector abort).
28    #[error("cancelled: {0}")]
29    Cancelled(String),
30
31    #[error("path not found: {0}")]
32    NotFound(PathBuf),
33
34    #[error("feature not implemented: {0}")]
35    NotImplemented(&'static str),
36
37    #[error(transparent)]
38    Io(#[from] std::io::Error),
39
40    #[error(transparent)]
41    Json(#[from] serde_json::Error),
42}
43
44/// The crate-wide result alias.
45pub type Result<T> = std::result::Result<T, RinneError>;