Skip to main content

sr_ai/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum SrAiError {
5    #[error("not in a git repository")]
6    NotAGitRepo,
7
8    #[error("no changes to commit")]
9    NoChanges,
10
11    #[error("no commits in plan")]
12    EmptyPlan,
13
14    #[error("git command failed: {0}")]
15    GitCommand(String),
16
17    #[error("AI backend failed: {0}")]
18    AiBackend(String),
19
20    #[error("no AI backend available (install `claude` or `gemini` CLI)")]
21    NoBackendAvailable,
22
23    #[error("failed to parse AI response: {0}")]
24    ParseResponse(String),
25
26    #[error("user cancelled")]
27    Cancelled,
28}