1use thiserror::Error;
2
3pub type Result<T> = anyhow::Result<T>;
4
5#[derive(Error, Debug)]
6pub enum GitWarpError {
7 #[error("Not in a git repository")]
8 NotInGitRepository,
9
10 #[error("Branch '{branch}' already exists")]
11 BranchAlreadyExists { branch: String },
12
13 #[error("Worktree '{path}' already exists")]
14 WorktreeAlreadyExists { path: String },
15
16 #[error("Branch '{branch}' not found")]
17 BranchNotFound { branch: String },
18
19 #[error("Worktree '{path}' not found")]
20 WorktreeNotFound { path: String },
21
22 #[error("Copy-on-Write is not supported on this filesystem")]
23 CoWNotSupported,
24
25 #[error("Failed to create worktree: {reason}")]
26 WorktreeCreationFailed { reason: String },
27
28 #[error("Terminal integration not supported on this platform")]
29 TerminalNotSupported,
30
31 #[error("No processes found in directory '{path}'")]
32 NoProcessesFound { path: String },
33
34 #[error("Failed to terminate processes: {reason}")]
35 ProcessTerminationFailed { reason: String },
36
37 #[error("Configuration error: {message}")]
38 ConfigError { message: String },
39}