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
use crate::pack;
use quick_error::quick_error;
use std::io;

quick_error! {
    #[derive(Debug)]
    pub enum Error {
        Io(err: io::Error) {
            display("An IO error occurred when reading the pack or creating a temporary file")
            from()
            source(err)
        }
        PackEntryDecode(err: pack::data::iter::Error) {
            display("A pack entry could not be extracted")
            from()
            source(err)
        }
        Unsupported(kind: pack::index::Kind) {
            display("Indices of type {} cannot be written, only {} are supported", *kind as usize, pack::index::Kind::default() as usize)
        }
        IteratorInvariantNoRefDelta {
            display("Ref delta objects are not supported as there is no way to look them up. Resolve them beforehand.")
        }
        IteratorInvariantTrailer {
            display("The iterator failed to set a trailing hash over all prior pack entries in the last provided entry")
        }
        IteratorInvariantBasesPresent {
            display("Did not encounter a single base")
        }
        IteratorInvariantTooManyObjects(num_objects: usize) {
            display("Only u32::MAX objects can be stored in a pack, found {}", num_objects)
        }
        IteratorInvariantBaseOffset(pack_offset: u64, distance: u64) {
            display("{} is not a valid offset for pack offset {}", distance, pack_offset)
        }
        Tree(err: pack::tree::Error) {
            display("An invariant regarding the delta tree did not hold")
            source(err)
            from()
        }
        TreeTraversal(err: pack::tree::traverse::Error) {
            display("Tree traversal failed")
            source(err)
            from()
        }
    }
}