1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! Scan failures.
use std::path::PathBuf;
/// Why a custom vocabulary file could not be used.
#[derive(Debug, thiserror::Error)]
pub(crate) enum CustomFailure {
#[error("the file could not be read")]
Io(#[source] std::io::Error),
#[error("the file is not valid UTF-8")]
Utf8,
#[error("the file is not valid TOML")]
Toml(#[source] Box<toml::de::Error>),
#[error("format version {0} is unsupported")]
Version(u32),
#[error("the word {0:?} is empty or holds whitespace or control characters")]
Word(String),
}
/// A failed scan.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// No git repository contains the scanned directory.
#[error("no git repository at or above {path}")]
Discover {
/// The scanned directory.
path: PathBuf,
/// The cause.
#[source]
source: gix::Error,
},
/// The repository has no working tree to compare against.
#[error("the repository at {0} is bare")]
Bare(PathBuf),
/// No `Cargo.toml` between the scanned directory and the repository root.
#[error("no Cargo.toml at or above {0}")]
NoManifest(PathBuf),
/// A revision did not resolve to a commit.
#[error("cannot resolve revision `{spec}`")]
Revision {
/// The revision as given.
spec: String,
/// The cause.
#[source]
source: gix::Error,
},
/// Walking the commit graph failed.
#[error("walking the commit history")]
Walk(#[source] gix::Error),
/// An object could not be read from the object database.
#[error("reading object {id}")]
Object {
/// The object.
id: gix::ObjectId,
/// The cause.
#[source]
source: gix::Error,
},
/// A tree could not be listed or traversed.
#[error("listing tree {id}")]
TreeList {
/// The tree.
id: gix::ObjectId,
/// The cause.
#[source]
source: gix::Error,
},
/// A file of the working tree could not be read.
#[error("reading {path}")]
Io {
/// The file.
path: PathBuf,
/// The cause.
#[source]
source: std::io::Error,
},
/// Walking the working tree failed.
#[error("walking the working tree")]
WorkTree(#[source] ignore::Error),
/// Hashing a working tree file failed.
#[error("hashing {path}")]
Hash {
/// The file.
path: String,
/// The cause.
#[source]
source: gix::Error,
},
/// A manifest is not valid TOML.
#[error("parsing {path}")]
Manifest {
/// The manifest.
path: String,
/// The cause.
#[source]
source: Box<toml::de::Error>,
},
/// A Rust file at head does not parse.
#[error("parsing {path}: {message}")]
Parse {
/// The file.
path: String,
/// The parser's message.
message: String,
},
/// A Markdown reader failed.
#[error("Markdown parser failed while reading {path}")]
Markdown {
/// The input file.
path: String,
},
/// `cargo metadata` failed on a manifest refquiem wrote to locate dependency sources.
#[error("running cargo metadata on {path}")]
Metadata {
/// The manifest.
path: PathBuf,
/// The cause.
#[source]
source: Box<cargo_metadata::Error>,
},
/// The fetched sources of a removed dependency hold no library.
#[error("dependency `{name}` has no library target in its fetched sources")]
NoLibrary {
/// The dependency key.
name: String,
},
/// The thread a scan runs on could not start.
#[error("starting the scan thread")]
Thread(#[source] std::io::Error),
/// A config file has invalid syntax, values, or keys.
#[error("reading the config file {path}")]
Config {
/// The config file.
path: PathBuf,
/// The cause.
#[source]
source: Box<toml::de::Error>,
},
/// A custom vocabulary file cannot be read, is not valid TOML, or carries
/// unsupported values.
#[error("reading the custom vocabulary {path}")]
Custom {
/// The custom vocabulary file.
path: PathBuf,
/// The cause.
#[source]
source: Box<dyn std::error::Error + Send + Sync>,
},
/// `--package` names no workspace member.
#[error("no workspace member is named `{0}`")]
UnknownPackage(String),
/// An exclude glob is not valid gitignore syntax.
#[error("reading the exclude globs")]
Exclude(#[source] ignore::Error),
}