aboutsummaryrefslogtreecommitdiff
path: root/object/store/packed/internal/ingest/errors.go
blob: cbad1e773525aee0ab11bd29bb5b3aca9efa4111 (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
59
60
61
62
63
64
65
66
67
68
package ingest

import (
	"errors"
	"fmt"
)

// InvalidPackHeaderError reports an invalid or unsupported pack header.
type InvalidPackHeaderError struct {
	Reason string
}

// Error implements error.
func (err *InvalidPackHeaderError) Error() string {
	return "packfile/ingest: invalid pack header: " + err.Reason
}

// PackTrailerMismatchError reports a mismatch between computed and trailer pack hash.
type PackTrailerMismatchError struct{}

// Error implements error.
func (err *PackTrailerMismatchError) Error() string {
	return "packfile/ingest: pack trailer hash mismatch"
}

// ThinPackUnresolvedError reports unresolved REF deltas when fixThin is disabled
// or when required bases cannot be found in base.
type ThinPackUnresolvedError struct {
	Count int
}

// Error implements error.
func (err *ThinPackUnresolvedError) Error() string {
	return fmt.Sprintf("packfile/ingest: unresolved thin deltas: %d", err.Count)
}

// MalformedPackEntryError reports malformed entry encoding at one pack offset.
type MalformedPackEntryError struct {
	Offset uint64
	Reason string
}

// Error implements error.
func (err *MalformedPackEntryError) Error() string {
	return fmt.Sprintf("packfile/ingest: malformed pack entry at offset %d: %s", err.Offset, err.Reason)
}

// DeltaCycleError reports a detected cycle in delta dependency resolution.
type DeltaCycleError struct {
	Offset uint64
}

// Error implements error.
func (err *DeltaCycleError) Error() string {
	return fmt.Sprintf("packfile/ingest: delta cycle detected at offset %d", err.Offset)
}

// DestinationWriteError reports destination I/O failures.
type DestinationWriteError struct {
	Op string
}

// Error implements error.
func (err *DestinationWriteError) Error() string {
	return "packfile/ingest: destination write failure: " + err.Op
}

var errExternalThinBase = errors.New("packfile/ingest: external thin base required")