Skip to main content

git_claw/workflow/
error.rs

1//! Workflow error types.
2
3use crate::core::error::{BranchError, ConfigError, PortError};
4use crate::infra::error::{GitError, HookError, LockError, RegistryError, WorktreeError};
5use thiserror::Error;
6
7#[derive(Error, Debug)]
8pub enum WorkflowError {
9    #[error("Slot name '{0}' is already active in this repository")]
10    DuplicateSlotName(String),
11
12    #[error("Worktree '{0}' not found in active slots registry")]
13    WorktreeNotFound(String),
14
15    #[error("Cannot infer active worktree from current directory '{0}'")]
16    CannotInferWorktree(String),
17
18    #[error("No git remote configured for this repository")]
19    NoRemoteConfigured,
20
21    #[error("Primary repository working tree has uncommitted modifications; cannot merge safely")]
22    DirtyWorkingTree,
23
24    #[error("Branch '{0}' already exists in this repository")]
25    BranchExists(String),
26
27    #[error("Command execution failed: {0}")]
28    CommandExecutionFailed(String),
29
30    #[error("{0}")]
31    ExecutionFailed(String),
32
33    #[error("No command specified to execute")]
34    NoCommandSpecified,
35
36    #[error("Invalid SemVer version '{0}': expected format like 'v1.2.0' or '1.2.0'")]
37    InvalidSemVer(String),
38
39    #[error(transparent)]
40    Config(#[from] ConfigError),
41
42    #[error(transparent)]
43    Port(#[from] PortError),
44
45    #[error(transparent)]
46    Branch(#[from] BranchError),
47
48    #[error(transparent)]
49    Git(#[from] GitError),
50
51    #[error(transparent)]
52    Lock(#[from] LockError),
53
54    #[error(transparent)]
55    Registry(#[from] RegistryError),
56
57    #[error(transparent)]
58    Worktree(#[from] WorktreeError),
59
60    #[error(transparent)]
61    Hook(#[from] HookError),
62
63    #[error("I/O error: {0}")]
64    Io(#[from] std::io::Error),
65}