1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum DialError {
5 #[error("DIAL not initialized. Run 'dial init' first.")]
6 NotInitialized,
7
8 #[error("Database error: {0}")]
9 Database(#[from] rusqlite::Error),
10
11 #[error("IO error: {0}")]
12 Io(#[from] std::io::Error),
13
14 #[error("Phase '{0}' not found")]
15 PhaseNotFound(String),
16
17 #[error("Task #{0} not found")]
18 TaskNotFound(i64),
19
20 #[error("Spec section #{0} not found")]
21 SpecSectionNotFound(i64),
22
23 #[error("Learning #{0} not found")]
24 LearningNotFound(i64),
25
26 #[error("No iteration in progress")]
27 NoIterationInProgress,
28
29 #[error("No pending tasks")]
30 NoPendingTasks,
31
32 #[error("Task #{0} has exceeded max fix attempts")]
33 MaxAttemptsExceeded(i64),
34
35 #[error("Not a git repository")]
36 NotGitRepo,
37
38 #[error("Git operation failed: {0}")]
39 GitError(String),
40
41 #[error("Command failed: {0}")]
42 CommandFailed(String),
43
44 #[error("Command timed out after {0} seconds")]
45 CommandTimeout(u64),
46
47 #[error("Invalid config key: {0}")]
48 InvalidConfigKey(String),
49
50 #[error("Invalid configuration: {0}")]
51 InvalidConfig(String),
52
53 #[error("Specs directory '{0}' not found")]
54 SpecsDirNotFound(String),
55
56 #[error("{0}")]
57 UserError(String),
58}
59
60pub type Result<T> = std::result::Result<T, DialError>;