Skip to content

Commit a7352d3

Browse files
committed
#137 Throw not found instead of internal error
1 parent b58a32d commit a7352d3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/adapter/kubernetes/blueprintcr/v3/blueprintSpecCRRepository.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ func (repo *blueprintSpecRepo) getMaskManifest(ctx context.Context, blueprintId
110110
if blueprintCR.Spec.MaskSource.CrRef != nil {
111111
blueprintMask, maskErr := repo.blueprintMaskClient.Get(ctx, blueprintCR.Spec.MaskSource.CrRef.Name, metav1.GetOptions{})
112112
if maskErr != nil {
113-
return nil, &domainservice.InternalError{WrappedError: maskErr, Message: fmt.Sprintf("could not get blueprint mask from ref %q in blueprint %q", blueprintCR.Spec.MaskSource.CrRef.Name, blueprintId)}
113+
return nil, &domainservice.NotFoundError{
114+
WrappedError: maskErr,
115+
Message: fmt.Sprintf("could not get blueprint mask from ref %q in blueprint %q", blueprintCR.Spec.MaskSource.CrRef.Name, blueprintId),
116+
DoNotRetry: false,
117+
}
114118
}
115119

116120
maskManifest = blueprintMask.Spec.BlueprintMaskManifest

pkg/adapter/kubernetes/blueprintcr/v3/blueprintSpecCRRepository_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func Test_blueprintSpecRepo_GetById(t *testing.T) {
194194

195195
// then
196196
require.Error(t, err)
197-
var expectedErrorType *domainservice.InternalError
197+
var expectedErrorType *domainservice.NotFoundError
198198
assert.ErrorAs(t, err, &expectedErrorType)
199199
assert.ErrorContains(t, err, fmt.Sprintf("could not get blueprint mask from ref %q in blueprint %q", "my-blueprint-mask", blueprintId))
200200
})

0 commit comments

Comments
 (0)