use crate::error::body_error::BodyError;
use crate::error::footer_error::FooterError;
use crate::error::git_error::{ConfigStatusCheckError, GitKindError};
use crate::error::header_error::HeaderError;
use std::path::PathBuf;
use thiserror::Error;
#[derive(thiserror::Error, Debug)]
pub enum CommitMsgError {
#[error("{0}")]
Header(#[from] HeaderError),
#[error("{0}")]
Body(#[from] BodyError),
#[error("{0}")]
Footer(#[from] FooterError),
#[error("{0}")]
ConfigStatus(#[from] ConfigStatusCheckError),
#[error("{0}")]
GitKind(#[from] GitKindError),
#[error("{0}")]
System(#[from] SystemError),
}
#[derive(Error, Debug)]
pub enum SystemError {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("parse error: {0}")]
Parse(String),
#[error("failed to find git repo root: {0}")]
RepoRootNotFound(String),
#[error("failed to read file `{path}`: {source}")]
IoPath {
path: PathBuf,
source: std::io::Error,
},
#[error("system error: {0}")]
Other(String),
}