@@ -4,6 +4,72 @@ use std::{
44} ;
55use thiserror:: Error ;
66
7+ ///
8+ #[ derive( Error , Debug ) ]
9+ pub enum GixError {
10+ ///
11+ #[ error( "gix::discover error: {0}" ) ]
12+ Discover ( #[ from] Box < gix:: discover:: Error > ) ,
13+
14+ ///
15+ #[ error( "gix::head::peel::to_commit error: {0}" ) ]
16+ HeadPeelToCommit ( #[ from] gix:: head:: peel:: to_commit:: Error ) ,
17+
18+ ///
19+ #[ error( "gix::object::find::existing::with_conversion::Error error: {0}" ) ]
20+ ObjectFindExistingWithConversionError (
21+ #[ from] gix:: object:: find:: existing:: with_conversion:: Error ,
22+ ) ,
23+
24+ ///
25+ #[ error( "gix::objs::decode::Error error: {0}" ) ]
26+ ObjsDecode ( #[ from] gix:: objs:: decode:: Error ) ,
27+
28+ ///
29+ #[ error( "gix::pathspec::init::Error error: {0}" ) ]
30+ PathspecInit ( #[ from] Box < gix:: pathspec:: init:: Error > ) ,
31+
32+ ///
33+ #[ error( "gix::reference::find::existing error: {0}" ) ]
34+ ReferenceFindExisting (
35+ #[ from] gix:: reference:: find:: existing:: Error ,
36+ ) ,
37+
38+ ///
39+ #[ error( "gix::reference::head_tree_id::Error error: {0}" ) ]
40+ ReferenceHeadTreeId ( #[ from] gix:: reference:: head_tree_id:: Error ) ,
41+
42+ ///
43+ #[ error( "gix::revision::walk error: {0}" ) ]
44+ RevisionWalk ( #[ from] gix:: revision:: walk:: Error ) ,
45+
46+ ///
47+ #[ error( "gix::status::Error error: {0}" ) ]
48+ Status ( #[ from] Box < gix:: status:: Error > ) ,
49+
50+ ///
51+ #[ error( "gix::status::index_worktree::Error error: {0}" ) ]
52+ StatusIndexWorktree (
53+ #[ from] Box < gix:: status:: index_worktree:: Error > ,
54+ ) ,
55+
56+ ///
57+ #[ error( "gix::status::into_iter::Error error: {0}" ) ]
58+ StatusIntoIter ( #[ from] Box < gix:: status:: into_iter:: Error > ) ,
59+
60+ ///
61+ #[ error( "gix::status::iter::Error error: {0}" ) ]
62+ StatusIter ( #[ from] Box < gix:: status:: iter:: Error > ) ,
63+
64+ ///
65+ #[ error( "gix::status::tree_index::Error error: {0}" ) ]
66+ StatusTreeIndex ( #[ from] Box < gix:: status:: tree_index:: Error > ) ,
67+
68+ ///
69+ #[ error( "gix::worktree::open_index::Error error: {0}" ) ]
70+ WorktreeOpenIndex ( #[ from] Box < gix:: worktree:: open_index:: Error > ) ,
71+ }
72+
773///
874#[ derive( Error , Debug ) ]
975pub enum Error {
@@ -96,70 +162,8 @@ pub enum Error {
96162 Sign ( #[ from] crate :: sync:: sign:: SignError ) ,
97163
98164 ///
99- #[ error( "gix::discover error: {0}" ) ]
100- GixDiscover ( #[ from] Box < gix:: discover:: Error > ) ,
101-
102- ///
103- #[ error( "gix::reference::find::existing error: {0}" ) ]
104- GixReferenceFindExisting (
105- #[ from] gix:: reference:: find:: existing:: Error ,
106- ) ,
107-
108- ///
109- #[ error( "gix::head::peel::to_commit error: {0}" ) ]
110- GixHeadPeelToCommit ( #[ from] gix:: head:: peel:: to_commit:: Error ) ,
111-
112- ///
113- #[ error( "gix::revision::walk error: {0}" ) ]
114- GixRevisionWalk ( #[ from] gix:: revision:: walk:: Error ) ,
115-
116- ///
117- #[ error( "gix::objs::decode::Error error: {0}" ) ]
118- GixObjsDecode ( #[ from] gix:: objs:: decode:: Error ) ,
119-
120- ///
121- #[ error( "gix::object::find::existing::with_conversion::Error error: {0}" ) ]
122- GixObjectFindExistingWithConversionError (
123- #[ from] gix:: object:: find:: existing:: with_conversion:: Error ,
124- ) ,
125-
126- ///
127- #[ error( "gix::pathspec::init::Error error: {0}" ) ]
128- GixPathspecInit ( #[ from] Box < gix:: pathspec:: init:: Error > ) ,
129-
130- ///
131- #[ error( "gix::reference::head_tree_id::Error error: {0}" ) ]
132- GixReferenceHeadTreeId (
133- #[ from] gix:: reference:: head_tree_id:: Error ,
134- ) ,
135-
136- ///
137- #[ error( "gix::status::Error error: {0}" ) ]
138- GixStatus ( #[ from] Box < gix:: status:: Error > ) ,
139-
140- ///
141- #[ error( "gix::status::iter::Error error: {0}" ) ]
142- GixStatusIter ( #[ from] Box < gix:: status:: iter:: Error > ) ,
143-
144- ///
145- #[ error( "gix::status::into_iter::Error error: {0}" ) ]
146- GixStatusIntoIter ( #[ from] Box < gix:: status:: into_iter:: Error > ) ,
147-
148- ///
149- #[ error( "gix::status::index_worktree::Error error: {0}" ) ]
150- GixStatusIndexWorktree (
151- #[ from] Box < gix:: status:: index_worktree:: Error > ,
152- ) ,
153-
154- ///
155- #[ error( "gix::status::tree_index::Error error: {0}" ) ]
156- GixStatusTreeIndex ( #[ from] Box < gix:: status:: tree_index:: Error > ) ,
157-
158- ///
159- #[ error( "gix::worktree::open_index::Error error: {0}" ) ]
160- GixWorktreeOpenIndex (
161- #[ from] Box < gix:: worktree:: open_index:: Error > ,
162- ) ,
165+ #[ error( "gix error:{0}" ) ]
166+ Gix ( #[ from] GixError ) ,
163167
164168 ///
165169 #[ error( "amend error: config commit.gpgsign=true detected.\n gpg signing is not supported for amending non-last commits" ) ]
@@ -189,50 +193,138 @@ impl<T> From<crossbeam_channel::SendError<T>> for Error {
189193 }
190194}
191195
196+ impl From < gix:: discover:: Error > for GixError {
197+ fn from ( error : gix:: discover:: Error ) -> Self {
198+ Self :: Discover ( Box :: new ( error) )
199+ }
200+ }
201+
192202impl From < gix:: discover:: Error > for Error {
193203 fn from ( error : gix:: discover:: Error ) -> Self {
194- Self :: GixDiscover ( Box :: new ( error) )
204+ Self :: Gix ( GixError :: from ( error) )
205+ }
206+ }
207+
208+ impl From < gix:: head:: peel:: to_commit:: Error > for Error {
209+ fn from ( error : gix:: head:: peel:: to_commit:: Error ) -> Self {
210+ Self :: Gix ( GixError :: from ( error) )
211+ }
212+ }
213+
214+ impl From < gix:: object:: find:: existing:: with_conversion:: Error >
215+ for Error
216+ {
217+ fn from (
218+ error : gix:: object:: find:: existing:: with_conversion:: Error ,
219+ ) -> Self {
220+ Self :: Gix ( GixError :: from ( error) )
221+ }
222+ }
223+
224+ impl From < gix:: objs:: decode:: Error > for Error {
225+ fn from ( error : gix:: objs:: decode:: Error ) -> Self {
226+ Self :: Gix ( GixError :: from ( error) )
227+ }
228+ }
229+
230+ impl From < gix:: pathspec:: init:: Error > for GixError {
231+ fn from ( error : gix:: pathspec:: init:: Error ) -> Self {
232+ Self :: PathspecInit ( Box :: new ( error) )
195233 }
196234}
197235
198236impl From < gix:: pathspec:: init:: Error > for Error {
199237 fn from ( error : gix:: pathspec:: init:: Error ) -> Self {
200- Self :: GixPathspecInit ( Box :: new ( error) )
238+ Self :: Gix ( GixError :: from ( error) )
239+ }
240+ }
241+
242+ impl From < gix:: reference:: find:: existing:: Error > for Error {
243+ fn from ( error : gix:: reference:: find:: existing:: Error ) -> Self {
244+ Self :: Gix ( GixError :: from ( error) )
245+ }
246+ }
247+
248+ impl From < gix:: reference:: head_tree_id:: Error > for Error {
249+ fn from ( error : gix:: reference:: head_tree_id:: Error ) -> Self {
250+ Self :: Gix ( GixError :: from ( error) )
251+ }
252+ }
253+
254+ impl From < gix:: revision:: walk:: Error > for Error {
255+ fn from ( error : gix:: revision:: walk:: Error ) -> Self {
256+ Self :: Gix ( GixError :: from ( error) )
257+ }
258+ }
259+
260+ impl From < gix:: status:: Error > for GixError {
261+ fn from ( error : gix:: status:: Error ) -> Self {
262+ Self :: Status ( Box :: new ( error) )
201263 }
202264}
203265
204266impl From < gix:: status:: Error > for Error {
205267 fn from ( error : gix:: status:: Error ) -> Self {
206- Self :: GixStatus ( Box :: new ( error) )
268+ Self :: Gix ( GixError :: from ( error) )
269+ }
270+ }
271+
272+ impl From < gix:: status:: iter:: Error > for GixError {
273+ fn from ( error : gix:: status:: iter:: Error ) -> Self {
274+ Self :: StatusIter ( Box :: new ( error) )
207275 }
208276}
209277
210278impl From < gix:: status:: iter:: Error > for Error {
211279 fn from ( error : gix:: status:: iter:: Error ) -> Self {
212- Self :: GixStatusIter ( Box :: new ( error) )
280+ Self :: Gix ( GixError :: from ( error) )
281+ }
282+ }
283+
284+ impl From < gix:: status:: into_iter:: Error > for GixError {
285+ fn from ( error : gix:: status:: into_iter:: Error ) -> Self {
286+ Self :: StatusIntoIter ( Box :: new ( error) )
213287 }
214288}
215289
216290impl From < gix:: status:: into_iter:: Error > for Error {
217291 fn from ( error : gix:: status:: into_iter:: Error ) -> Self {
218- Self :: GixStatusIntoIter ( Box :: new ( error) )
292+ Self :: Gix ( GixError :: from ( error) )
293+ }
294+ }
295+
296+ impl From < gix:: status:: index_worktree:: Error > for GixError {
297+ fn from ( error : gix:: status:: index_worktree:: Error ) -> Self {
298+ Self :: StatusIndexWorktree ( Box :: new ( error) )
219299 }
220300}
221301
222302impl From < gix:: status:: index_worktree:: Error > for Error {
223303 fn from ( error : gix:: status:: index_worktree:: Error ) -> Self {
224- Self :: GixStatusIndexWorktree ( Box :: new ( error) )
304+ Self :: Gix ( GixError :: from ( error) )
305+ }
306+ }
307+
308+ impl From < gix:: status:: tree_index:: Error > for GixError {
309+ fn from ( error : gix:: status:: tree_index:: Error ) -> Self {
310+ Self :: StatusTreeIndex ( Box :: new ( error) )
225311 }
226312}
227313
228314impl From < gix:: status:: tree_index:: Error > for Error {
229315 fn from ( error : gix:: status:: tree_index:: Error ) -> Self {
230- Self :: GixStatusTreeIndex ( Box :: new ( error) )
316+ Self :: Gix ( GixError :: from ( error) )
317+ }
318+ }
319+
320+ impl From < gix:: worktree:: open_index:: Error > for GixError {
321+ fn from ( error : gix:: worktree:: open_index:: Error ) -> Self {
322+ Self :: WorktreeOpenIndex ( Box :: new ( error) )
231323 }
232324}
233325
234326impl From < gix:: worktree:: open_index:: Error > for Error {
235327 fn from ( error : gix:: worktree:: open_index:: Error ) -> Self {
236- Self :: GixWorktreeOpenIndex ( Box :: new ( error) )
328+ Self :: Gix ( GixError :: from ( error) )
237329 }
238330}
0 commit comments