aboutsummaryrefslogtreecommitdiff
path: root/format/commitgraph/read/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/commitgraph/read/errors.go
parentnetwork/receivepack: Rename from receivepack (diff)
signatureNo signature
format: Move commitgraph and packfile here
Diffstat (limited to 'format/commitgraph/read/errors.go')
-rw-r--r--format/commitgraph/read/errors.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/format/commitgraph/read/errors.go b/format/commitgraph/read/errors.go
new file mode 100644
index 00000000..0a32a368
--- /dev/null
+++ b/format/commitgraph/read/errors.go
@@ -0,0 +1,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)
+}