From bb5b5334c74026c0a46f48cf2418038e0d909e9b Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 20 Feb 2026 22:30:57 +0800 Subject: object: Remove the old opaque errors --- object/commit_serialize.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'object/commit_serialize.go') diff --git a/object/commit_serialize.go b/object/commit_serialize.go index b7c058a3..c34c44a3 100644 --- a/object/commit_serialize.go +++ b/object/commit_serialize.go @@ -2,6 +2,7 @@ package object import ( "bytes" + "errors" "fmt" "codeberg.org/lindenii/furgit/internal/objectheader" @@ -13,7 +14,7 @@ func (commit *Commit) SerializeWithoutHeader() ([]byte, error) { var buf bytes.Buffer if commit.Tree.Size() == 0 { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: missing tree id") } fmt.Fprintf(&buf, "tree %s\n", commit.Tree.String()) for _, parent := range commit.Parents { @@ -43,7 +44,7 @@ func (commit *Commit) SerializeWithoutHeader() ([]byte, error) { } for _, h := range commit.ExtraHeaders { if h.Key == "" { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: extra header has empty key") } buf.WriteString(h.Key) buf.WriteByte(' ') @@ -64,7 +65,7 @@ func (commit *Commit) SerializeWithHeader() ([]byte, error) { } header, ok := objectheader.Encode(objecttype.TypeCommit, int64(len(body))) if !ok { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: failed to encode object header") } raw := make([]byte, len(header)+len(body)) copy(raw, header) -- cgit v1.3.1-10-gc9f91