summaryrefslogtreecommitdiffstats
path: root/vendor/gix-revwalk/src/graph/errors.rs
blob: a2d849fbf436254b6141f0ec31cf558c1a8407c2 (plain)
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
///
pub mod lookup {
    /// The error returned by [`try_lookup()`][crate::Graph::try_lookup()].
    #[derive(Debug, thiserror::Error)]
    #[error("There was an error looking up a commit")]
    pub struct Error {
        #[from]
        source: Box<dyn std::error::Error + Send + Sync + 'static>,
    }

    ///
    pub mod commit {
        /// The error returned by [`try_lookup_or_insert_commit()`][crate::Graph::try_lookup_or_insert_commit()].
        #[derive(Debug, thiserror::Error)]
        #[allow(missing_docs)]
        pub enum Error {
            #[error(transparent)]
            Find(#[from] crate::graph::lookup::Error),
            #[error(transparent)]
            ToOwned(#[from] crate::graph::commit::to_owned::Error),
        }
    }

    ///
    pub mod existing {
        /// The error returned by [`lookup()`][crate::Graph::lookup()].
        #[derive(Debug, thiserror::Error)]
        #[allow(missing_docs)]
        pub enum Error {
            #[error(transparent)]
            Find(#[from] super::Error),
            #[error("Commit could not be found")]
            Missing,
        }
    }
}

///
pub mod insert_parents {
    use crate::graph::{commit::iter_parents, lookup};

    /// The error returned by [`insert_parents()`][crate::Graph::insert_parents()].
    #[derive(Debug, thiserror::Error)]
    #[allow(missing_docs)]
    pub enum Error {
        #[error(transparent)]
        Lookup(#[from] lookup::existing::Error),
        #[error("A commit could not be decoded during traversal")]
        Decode(#[from] gix_object::decode::Error),
        #[error(transparent)]
        Parent(#[from] iter_parents::Error),
    }
}