double_o/error.rs
1use thiserror::Error;
2
3/// Unified error type for the `oo` library.
4///
5/// Categorizes errors by their origin: command execution, storage,
6/// pattern parsing, configuration, learning, and more.
7#[derive(Debug, Error)]
8pub enum Error {
9 /// Command execution failed (I/O error).
10 #[error("command execution failed: {0}")]
11 Exec(#[from] std::io::Error),
12
13 /// Storage operation failed.
14 #[error("store error: {0}")]
15 Store(String),
16
17 /// Pattern parsing or matching error.
18 #[error("pattern error: {0}")]
19 Pattern(String),
20
21 /// Configuration file or environment error.
22 #[error("config error: {0}")]
23 Config(String),
24
25 /// Learning/initiated error (LLM integration error).
26 #[error("learn error: {0}")]
27 Learn(String),
28
29 /// Help generation or lookup error.
30 #[error("help lookup failed: {0}")]
31 Help(String),
32
33 /// Initialization error (e.g., hook creation failed).
34 #[error("init failed: {0}")]
35 Init(String),
36}