gix_blame/
error.rs

1use gix_object::bstr::BString;
2
3/// The error returned by [file()](crate::file()).
4#[derive(Debug, thiserror::Error)]
5#[allow(missing_docs)]
6pub enum Error {
7    #[error("No commit was given")]
8    EmptyTraversal,
9    #[error(transparent)]
10    BlobDiffSetResource(#[from] gix_diff::blob::platform::set_resource::Error),
11    #[error(transparent)]
12    BlobDiffPrepare(#[from] gix_diff::blob::platform::prepare_diff::Error),
13    #[error("The file to blame at '{file_path}' wasn't found in the first commit at {commit_id}")]
14    FileMissing {
15        /// The file-path to the object to blame.
16        file_path: BString,
17        /// The commit whose tree didn't contain `file_path`.
18        commit_id: gix_hash::ObjectId,
19    },
20    #[error("Couldn't find commit or tree in the object database")]
21    FindObject(#[from] gix_object::find::Error),
22    #[error("Could not find existing blob or commit")]
23    FindExistingObject(#[from] gix_object::find::existing_object::Error),
24    #[error("Could not find existing iterator over a tree")]
25    FindExistingIter(#[from] gix_object::find::existing_iter::Error),
26    #[error("Failed to obtain the next commit in the commit-graph traversal")]
27    Traverse(#[source] Box<dyn std::error::Error + Send + Sync>),
28    #[error(transparent)]
29    DiffTree(#[from] gix_diff::tree::Error),
30    #[error(transparent)]
31    DiffTreeWithRewrites(#[from] gix_diff::tree_with_rewrites::Error),
32    #[error("Invalid line range was given, line range is expected to be a 1-based inclusive range in the format '<start>,<end>'")]
33    InvalidLineRange,
34    #[error("Failure to decode commit during traversal")]
35    DecodeCommit(#[from] gix_object::decode::Error),
36    #[error("Failed to get parent from commitgraph during traversal")]
37    GetParentFromCommitGraph(#[from] gix_commitgraph::file::commit::Error),
38}