use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("workspace error: {0}")]
Workspace(String),
#[error("parse error: {0}")]
Parse(String),
#[error("bookmark '{0}' not found")]
BookmarkNotFound(String),
#[error("{0}")]
NoStack(String),
#[error("no supported remotes found (GitHub/GitLab)")]
NoSupportedRemotes,
#[error("remote '{0}' not found")]
RemoteNotFound(String),
#[error("authentication failed: {0}")]
Auth(String),
#[error("GitHub API error: {0}")]
GitHubApi(String),
#[error("GitLab API error: {0}")]
GitLabApi(String),
#[error("merge commit detected in bookmark '{0}' history - rebasing required")]
MergeCommitDetected(String),
#[error("revset error: {0}")]
Revset(String),
#[error("git operation failed: {0}")]
Git(String),
#[error("invalid configuration: {0}")]
Config(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("URL parse error: {0}")]
UrlParse(#[from] url::ParseError),
#[error("GitHub client error: {0}")]
Octocrab(#[from] octocrab::Error),
#[error("platform error: {0}")]
Platform(String),
#[error("internal error: {0}")]
Internal(String),
#[error("scheduler cycle detected: {message}")]
SchedulerCycle {
message: String,
cycle_nodes: Vec<String>,
},
#[error("invalid argument: {0}")]
InvalidArgument(String),
#[error("tracking error: {0}")]
Tracking(String),
}
pub type Result<T> = std::result::Result<T, Error>;