use thiserror::Error;
use crate::engine::error::{CoreError, GitError, LoadError};
pub type OpsResult<T> = Result<T, OpsError>;
#[derive(Debug, Error)]
pub enum OpsError {
#[error("git error: {0}")]
Git(#[from] GitError),
#[error("core error: {0}")]
Core(#[from] CoreError),
#[error("load error: {0}")]
Load(#[from] LoadError),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("command failed: {command}\n{stderr}")]
CommandFailed { command: String, stderr: String },
#[error("parse error: {0}")]
Parse(String),
#[error("{0}")]
Message(String),
#[error("rebase onto {onto} failed ({detail})")]
RebaseConflict { onto: String, detail: String },
#[error(
"refusing to rebase: recorded base {base} is not an ancestor of HEAD, so \
its history diverged. Reconcile by hand; the commits since the common \
ancestor are:\n{commits}"
)]
UnsafeRebaseBase { base: String, commits: String },
}