git_pack/index/traverse/
error.rs

1use crate::index;
2
3/// Returned by [`index::File::traverse_with_index()`] and [`index::File::traverse_with_lookup`]
4#[derive(thiserror::Error, Debug)]
5#[allow(missing_docs)]
6pub enum Error<E: std::error::Error + Send + Sync + 'static> {
7    #[error("One of the traversal processors failed")]
8    Processor(#[source] E),
9    #[error("Index file, pack file or object verification failed")]
10    VerifyChecksum(#[from] index::verify::checksum::Error),
11    #[error("The pack delta tree index could not be built")]
12    Tree(#[from] crate::cache::delta::from_offsets::Error),
13    #[error("The tree traversal failed")]
14    TreeTraversal(#[from] crate::cache::delta::traverse::Error),
15    #[error("Object {id} at offset {offset} could not be decoded")]
16    PackDecode {
17        id: git_hash::ObjectId,
18        offset: u64,
19        source: crate::data::decode::Error,
20    },
21    #[error("The packfiles checksum didn't match the index file checksum: expected {expected}, got {actual}")]
22    PackMismatch {
23        expected: git_hash::ObjectId,
24        actual: git_hash::ObjectId,
25    },
26    #[error("The hash of {kind} object at offset {offset} didn't match the checksum in the index file: expected {expected}, got {actual}")]
27    PackObjectMismatch {
28        expected: git_hash::ObjectId,
29        actual: git_hash::ObjectId,
30        offset: u64,
31        kind: git_object::Kind,
32    },
33    #[error(
34        "The CRC32 of {kind} object at offset {offset} didn't match the checksum in the index file: expected {expected}, got {actual}"
35    )]
36    Crc32Mismatch {
37        expected: u32,
38        actual: u32,
39        offset: u64,
40        kind: git_object::Kind,
41    },
42    #[error("Interrupted")]
43    Interrupted,
44}