vcs_modify_guard/
error.rs1use std::{error::Error, io, path::PathBuf};
2
3use snafu::Snafu;
4
5#[derive(Debug, Snafu)]
7#[non_exhaustive]
8#[snafu(visibility(pub(crate)))]
9pub enum ModifyGuardError {
10 #[snafu(display("not a VCS repository: {}", path.display()))]
13 NotARepository {
14 path: PathBuf,
16 },
17 #[snafu(display("repository has no worktree: {}", path.display()))]
20 RepositoryWithoutWorktree {
21 path: PathBuf,
23 },
24 #[snafu(display("path is inaccessible: {}", path.display()))]
26 InaccessiblePath {
27 path: PathBuf,
29 source: io::Error,
31 },
32 #[snafu(display("path not found: {}", path.display()))]
34 PathNotFound {
35 path: PathBuf,
37 },
38 #[snafu(display(
40 "path could not be resolved to a canonical path: {}",
41 path.display()
42 ))]
43 CanonicalizePath {
44 path: PathBuf,
46 source: io::Error,
48 },
49 #[snafu(display("path is not a directory: {}", path.display()))]
51 PathNotADirectory {
52 path: PathBuf,
54 },
55 #[snafu(display("path does not resolve to a file: {}", path.display()))]
57 PathNotAFile {
58 path: PathBuf,
60 },
61 #[snafu(display(
64 "path does not resolve to a valid path within the repository worktree: {}",
65 path.display()
66 ))]
67 ResolveAsWorktreeRelativePath {
68 path: PathBuf,
70 },
71 #[snafu(display(
73 "path does not resolve to a single file within the repository worktree: {}",
74 wt_path.display()
75 ))]
76 AmbiguousFilePath {
77 wt_path: PathBuf,
79 },
80 #[snafu(transparent)]
82 Backend {
83 source: Box<dyn Error + Send + Sync + 'static>,
85 },
86}
87
88const _: () = {
90 const fn assert_send_sync<T: Send + Sync>() {}
91 assert_send_sync::<ModifyGuardError>();
92};