1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum ConfigError {
8 #[error("Failed to read configuration file at '{path}': {source}")]
9 IoError {
10 path: String,
11 #[source]
12 source: std::io::Error,
13 },
14
15 #[error("Failed to parse .git-claw.toml: {message}")]
16 ParseError { message: String },
17}
18
19#[derive(Error, Debug, PartialEq, Eq)]
21pub enum PortError {
22 #[error("Port calculation overflow for key '{key}': base port {base_port} + slot {slot_id} exceeds 65535")]
23 PortOverflow {
24 key: String,
25 base_port: u16,
26 slot_id: u32,
27 },
28}
29
30#[derive(Error, Debug, PartialEq, Eq)]
32pub enum BranchError {
33 #[error("Invalid branch type '{0}'; expected feature, bugfix, hotfix, or spike")]
34 InvalidBranchType(String),
35
36 #[error("Worktree name cannot be empty")]
37 EmptyName,
38
39 #[error("Invalid worktree name '{0}'; must be lowercase kebab-case (e.g. 'my-feature-1')")]
40 InvalidKebabCase(String),
41}