aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read/errors.go
blob: 0a32a368234d8a9ebb334ff4d0f2edf017c84c9d (about) (plain) (blame)
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
54
55
56
57
58
package read

import (
	"fmt"

	objectid "codeberg.org/lindenii/furgit/object/id"
)

// NotFoundError reports a missing commit graph entry by object ID.
type NotFoundError struct {
	OID objectid.ObjectID
}

// Error implements error.
func (err *NotFoundError) Error() string {
	return fmt.Sprintf("commitgraph: object not found: %s", err.OID)
}

// PositionOutOfRangeError reports an invalid graph position.
type PositionOutOfRangeError struct {
	Pos Position
}

// Error implements error.
func (err *PositionOutOfRangeError) Error() string {
	return fmt.Sprintf("commitgraph: position out of range: graph=%d index=%d", err.Pos.Graph, err.Pos.Index)
}

// MalformedError reports malformed commit-graph data.
type MalformedError struct {
	Path   string
	Reason string
}

// Error implements error.
func (err *MalformedError) Error() string {
	return fmt.Sprintf("commitgraph: malformed %q: %s", err.Path, err.Reason)
}

// UnsupportedVersionError reports unsupported commit-graph version.
type UnsupportedVersionError struct {
	Version uint8
}

// Error implements error.
func (err *UnsupportedVersionError) Error() string {
	return fmt.Sprintf("commitgraph: unsupported version %d", err.Version)
}

// BloomUnavailableError reports missing changed-path bloom data at one position.
type BloomUnavailableError struct {
	Pos Position
}

// Error implements error.
func (err *BloomUnavailableError) Error() string {
	return fmt.Sprintf("commitgraph: bloom unavailable at position graph=%d index=%d", err.Pos.Graph, err.Pos.Index)
}