1use thiserror::Error;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("workspace error: {0}")]
13 Workspace(String),
14
15 #[error("parse error: {0}")]
17 Parse(String),
18
19 #[error("bookmark '{0}' not found")]
21 BookmarkNotFound(String),
22
23 #[error("{0}")]
25 NoStack(String),
26
27 #[error("no supported remotes found (GitHub/GitLab)")]
29 NoSupportedRemotes,
30
31 #[error("remote '{0}' not found")]
33 RemoteNotFound(String),
34
35 #[error("authentication failed: {0}")]
37 Auth(String),
38
39 #[error("GitHub API error: {0}")]
41 GitHubApi(String),
42
43 #[error("GitLab API error: {0}")]
45 GitLabApi(String),
46
47 #[error("merge commit detected in bookmark '{0}' history - rebasing required")]
49 MergeCommitDetected(String),
50
51 #[error("revset error: {0}")]
53 Revset(String),
54
55 #[error("git operation failed: {0}")]
57 Git(String),
58
59 #[error("invalid configuration: {0}")]
61 Config(String),
62
63 #[error("IO error: {0}")]
65 Io(#[from] std::io::Error),
66
67 #[error("HTTP error: {0}")]
69 Http(#[from] reqwest::Error),
70
71 #[error("JSON error: {0}")]
73 Json(#[from] serde_json::Error),
74
75 #[error("URL parse error: {0}")]
77 UrlParse(#[from] url::ParseError),
78
79 #[error("GitHub client error: {0}")]
81 Octocrab(#[from] octocrab::Error),
82
83 #[error("platform error: {0}")]
85 Platform(String),
86
87 #[error("internal error: {0}")]
89 Internal(String),
90
91 #[error("scheduler cycle detected: {message}")]
93 SchedulerCycle {
94 message: String,
96 cycle_nodes: Vec<String>,
98 },
99
100 #[error("invalid argument: {0}")]
102 InvalidArgument(String),
103
104 #[error("tracking error: {0}")]
106 Tracking(String),
107}
108
109pub type Result<T> = std::result::Result<T, Error>;