use std::{error::Error, io, path::PathBuf};
use snafu::Snafu;
#[derive(Debug, Snafu)]
#[non_exhaustive]
#[snafu(visibility(pub(crate)))]
pub enum ModifyGuardError {
#[snafu(display("not a VCS repository: {}", path.display()))]
NotARepository {
path: PathBuf,
},
#[snafu(display("repository has no worktree: {}", path.display()))]
RepositoryWithoutWorktree {
path: PathBuf,
},
#[snafu(display("path is inaccessible: {}", path.display()))]
InaccessiblePath {
path: PathBuf,
source: io::Error,
},
#[snafu(display("path not found: {}", path.display()))]
PathNotFound {
path: PathBuf,
},
#[snafu(display(
"path could not be resolved to a canonical path: {}",
path.display()
))]
CanonicalizePath {
path: PathBuf,
source: io::Error,
},
#[snafu(display("path is not a directory: {}", path.display()))]
PathNotADirectory {
path: PathBuf,
},
#[snafu(display("path does not resolve to a file: {}", path.display()))]
PathNotAFile {
path: PathBuf,
},
#[snafu(display(
"path does not resolve to a valid path within the repository worktree: {}",
path.display()
))]
ResolveAsWorktreeRelativePath {
path: PathBuf,
},
#[snafu(display(
"path does not resolve to a single file within the repository worktree: {}",
wt_path.display()
))]
AmbiguousFilePath {
wt_path: PathBuf,
},
#[snafu(transparent)]
Backend {
source: Box<dyn Error + Send + Sync + 'static>,
},
}
const _: () = {
const fn assert_send_sync<T: Send + Sync>() {}
assert_send_sync::<ModifyGuardError>();
};