From 712726622f0d2abcf31ac0d40f57014cc915cc7c Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 15 Jun 2023 12:33:58 +0200 Subject: praefect/coordinator: Untangle NotFound errors from storage layer The datastore is reusing errors from the storage layer even though these are conceptually orthogonal to each other. Furthermore, given that we sometimes don't have the storage name and relative path available but just the repository ID, we need to use different error types depending on the callsite. Refactor the package to instead use its own ErrRepositoryNotFound error. This also allows us to get rid of the `RepositoryNotFoundError` type, where we instead inject error code and metadata in a central place in the coordinator given that it has more context. --- internal/praefect/reconciler/reconciler_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/praefect/reconciler') diff --git a/internal/praefect/reconciler/reconciler_test.go b/internal/praefect/reconciler/reconciler_test.go index f421df15e..4cfcc3a80 100644 --- a/internal/praefect/reconciler/reconciler_test.go +++ b/internal/praefect/reconciler/reconciler_test.go @@ -1041,7 +1041,7 @@ func TestReconciler(t *testing.T) { var err error existing.Job.RepositoryID, err = rs.GetRepositoryID(ctx, existing.Job.VirtualStorage, existing.Job.RelativePath) if err != nil { - require.Equal(t, storage.NewRepositoryNotFoundError(existing.Job.VirtualStorage, existing.Job.RelativePath), err) + require.Equal(t, datastore.ErrRepositoryNotFound, err) } var id int64 -- cgit v1.2.3