aboutsummaryrefslogtreecommitdiff
path: root/format/packfile/ingest/errors.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-26 09:17:14 +0000
committerGravatar Runxi Yu2026-03-26 09:18:30 +0000
commit3e884f5f3d42cbc4874a04da31dde10314b0cfad (patch)
treef5e1e325fd1a2a0801791c054010213214475d80 /format/packfile/ingest/errors.go
parentnetwork/receivepack: Rename from receivepack (diff)
signatureNo signature
format: Move commitgraph and packfile here
Diffstat (limited to 'format/packfile/ingest/errors.go')
-rw-r--r--format/packfile/ingest/errors.go75
1 files changed, 75 insertions, 0 deletions
diff --git a/format/packfile/ingest/errors.go b/format/packfile/ingest/errors.go
new file mode 100644
index 00000000..f6ee9757
--- /dev/null
+++ b/format/packfile/ingest/errors.go
@@ -0,0 +1,75 @@
+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")
+
+var (
+ // ErrZeroObjectContinue indicates Continue was called for a zero-object pack.
+ ErrZeroObjectContinue = errors.New("packfile/ingest: cannot continue zero-object pack")
+ // ErrNonZeroDiscard indicates Discard was called for a non-zero-object pack.
+ ErrNonZeroDiscard = errors.New("packfile/ingest: cannot discard non-zero pack")
+)