Showing the changes to git-traverse/src/commit.rs (1 of 4 files). Show all
Unified · Split
| @@ -50,25 +50,20 @@ pub mod ancestors { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | use git_hash::{oid, ObjectId}; |
| 52 | 52 | use git_object::CommitRefIter; |
| 53 | − use quick_error::quick_error; | |
| 54 | 53 | |
| 55 | 54 | use crate::commit::{Ancestors, Parents, Sorting}; |
| 56 | 55 | |
| 57 | − quick_error! { | |
| 58 | − /// The error is part of the item returned by the [Ancestors] iterator. | |
| 59 | − #[derive(Debug)] | |
| 60 | − #[allow(missing_docs)] | |
| 61 | − pub enum Error { | |
| 62 | − FindExisting{oid: ObjectId, err: Box<dyn std::error::Error + Send + Sync + 'static> } { | |
| 63 | − display("The commit {} could not be found", oid) | |
| 64 | − source(&**err) | |
| 65 | − } | |
| 66 | − ObjectDecode(err: git_object::decode::Error) { | |
| 67 | − display("An object could not be decoded") | |
| 68 | − source(err) | |
| 69 | − from() | |
| 70 | − } | |
| 71 | − } | |
| 56 | + /// The error is part of the item returned by the [Ancestors] iterator. | |
| 57 | + #[derive(Debug, thiserror::Error)] | |
| 58 | + #[allow(missing_docs)] | |
| 59 | + pub enum Error { | |
| 60 | + #[error("The commit {oid} could not be found")] | |
| 61 | + FindExisting { | |
| 62 | + oid: ObjectId, | |
| 63 | + source: Box<dyn std::error::Error + Send + Sync + 'static>, | |
| 64 | + }, | |
| 65 | + #[error(transparent)] | |
| 66 | + ObjectDecode(#[from] git_object::decode::Error), | |
| 72 | 67 | } |
| 73 | 68 | |
| 74 | 69 | type TimeInSeconds = u32; |
| @@ -112,7 +107,7 @@ pub mod ancestors { · 37 unmodified lines | ||
| 112 | 107 | for (commit_id, commit_time) in state.next.iter_mut() { |
| 113 | 108 | let commit_iter = (self.find)(commit_id, &mut state.buf).map_err(|err| Error::FindExisting { |
| 114 | 109 | oid: *commit_id, |
| 115 | − err: err.into(), | |
| 110 | + source: err.into(), | |
| 116 | 111 | })?; |
| 117 | 112 | *commit_time = commit_iter.committer()?.time.seconds_since_unix_epoch; |
| 118 | 113 | } |
| @@ -266,7 +261,12 @@ pub mod ancestors { · 147 unmodified lines | ||
| 266 | 261 | } |
| 267 | 262 | } |
| 268 | 263 | } |
| 269 | − Err(err) => return Some(Err(Error::FindExisting { oid, err: err.into() })), | |
| 264 | + Err(err) => { | |
| 265 | + return Some(Err(Error::FindExisting { | |
| 266 | + oid, | |
| 267 | + source: err.into(), | |
| 268 | + })) | |
| 269 | + } | |
| 270 | 270 | } |
| 271 | 271 | Some(Ok(oid)) |
| 272 | 272 | } |
| @@ -301,7 +301,12 @@ pub mod ancestors { · 28 unmodified lines | ||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | − Err(err) => return Some(Err(Error::FindExisting { oid, err: err.into() })), | |
| 304 | + Err(err) => { | |
| 305 | + return Some(Err(Error::FindExisting { | |
| 306 | + oid, | |
| 307 | + source: err.into(), | |
| 308 | + })) | |
| 309 | + } | |
| 305 | 310 | } |
| 306 | 311 | Some(Ok(oid)) |
| 307 | 312 | } |