Skip to main content

gitcortex_core/
error.rs

1use std::path::PathBuf;
2
3use thiserror::Error;
4
5/// Central error type for all GitCortex crates.
6///
7/// Each variant is a distinct failure domain. Crates that wrap external
8/// library errors (e.g. git2, kuzu) convert them to the appropriate variant
9/// at their own boundary — keeping this crate free of I/O dependencies.
10#[derive(Debug, Error)]
11pub enum GitCortexError {
12    #[error("parse error in {file}: {message}")]
13    Parse { file: PathBuf, message: String },
14
15    /// Git operation failed. Populated by gitcortex-indexer.
16    #[error("git error: {0}")]
17    Git(String),
18
19    /// Graph store operation failed. Populated by gitcortex-store.
20    #[error("store error: {0}")]
21    Store(String),
22
23    #[error("io error: {0}")]
24    Io(#[from] std::io::Error),
25
26    #[error("branch '{branch}' not found in store")]
27    BranchNotFound { branch: String },
28
29    #[error("config error: {0}")]
30    Config(String),
31}
32
33pub type Result<T> = std::result::Result<T, GitCortexError>;