From 84aac13e64962806e5101abc461be50198ac5642 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 29 Mar 2026 15:10:21 +0000 Subject: object/fetch: Use proper errors --- object/fetch/exact_commit.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'object/fetch/exact_commit.go') diff --git a/object/fetch/exact_commit.go b/object/fetch/exact_commit.go index 1b330e7d..9483b2b1 100644 --- a/object/fetch/exact_commit.go +++ b/object/fetch/exact_commit.go @@ -1,11 +1,11 @@ package fetch import ( - "fmt" - + giterrors "codeberg.org/lindenii/furgit/errors" "codeberg.org/lindenii/furgit/object/commit" objectid "codeberg.org/lindenii/furgit/object/id" "codeberg.org/lindenii/furgit/object/stored" + objecttype "codeberg.org/lindenii/furgit/object/type" ) // ExactCommit reads, parses, and wraps the commit at id. @@ -19,7 +19,7 @@ func (r *Fetcher) ExactCommit(id objectid.ObjectID) (*stored.Stored[*commit.Comm commit, ok := parsed.(*commit.Commit) if !ok { - return nil, fmt.Errorf("object/fetch: expected commit object %s, got %v", id, parsed.ObjectType()) + return nil, &giterrors.ObjectTypeError{OID: id, Got: parsed.ObjectType(), Want: objecttype.TypeCommit} } return stored.New(id, commit), nil -- cgit v1.3.1-10-gc9f91