@@ -4,6 +4,72 @@ use std::{
4
4
} ;
5
5
use thiserror:: Error ;
6
6
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
+
7
73
///
8
74
#[ derive( Error , Debug ) ]
9
75
pub enum Error {
@@ -96,70 +162,8 @@ pub enum Error {
96
162
Sign ( #[ from] crate :: sync:: sign:: SignError ) ,
97
163
98
164
///
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 ) ,
163
167
164
168
///
165
169
#[ 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 {
189
193
}
190
194
}
191
195
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
+
192
202
impl From < gix:: discover:: Error > for Error {
193
203
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) )
195
233
}
196
234
}
197
235
198
236
impl From < gix:: pathspec:: init:: Error > for Error {
199
237
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) )
201
263
}
202
264
}
203
265
204
266
impl From < gix:: status:: Error > for Error {
205
267
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) )
207
275
}
208
276
}
209
277
210
278
impl From < gix:: status:: iter:: Error > for Error {
211
279
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) )
213
287
}
214
288
}
215
289
216
290
impl From < gix:: status:: into_iter:: Error > for Error {
217
291
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) )
219
299
}
220
300
}
221
301
222
302
impl From < gix:: status:: index_worktree:: Error > for Error {
223
303
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) )
225
311
}
226
312
}
227
313
228
314
impl From < gix:: status:: tree_index:: Error > for Error {
229
315
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) )
231
323
}
232
324
}
233
325
234
326
impl From < gix:: worktree:: open_index:: Error > for Error {
235
327
fn from ( error : gix:: worktree:: open_index:: Error ) -> Self {
236
- Self :: GixWorktreeOpenIndex ( Box :: new ( error) )
328
+ Self :: Gix ( GixError :: from ( error) )
237
329
}
238
330
}
0 commit comments