1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GitGardenerError {
5 #[error("Git error: {0}")]
6 Git(#[from] git2::Error),
7
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11
12 #[error("Config file not found at {path}")]
13 ConfigNotFound { path: String },
14
15 #[error("Invalid configuration: {message}")]
16 InvalidConfig { message: String },
17
18 #[error("Worktree '{name}' already exists")]
19 WorktreeExists { name: String },
20
21 #[error("Worktree '{name}' not found")]
22 WorktreeNotFound { name: String },
23
24 #[error("Not in a git repository")]
25 NotInRepository,
26
27 #[error("{0}")]
28 Custom(String),
29}
30
31pub type Result<T> = std::result::Result<T, GitGardenerError>;