From f4abc30c21a671dd1711ed07d34e42b73eea7dbe Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 17 Dec 2024 14:36:44 -0800 Subject: [PATCH] submissions: return 404 when ErrNotExist --- pkg/service/service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/service/service.go b/pkg/service/service.go index 72abde2..36e9171 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -25,6 +25,9 @@ type Service struct { // Used for common default response. func (svc *Service) NewError(ctx context.Context, err error) *api.ErrorStatusCode { status := 500 + if errors.Is(err, datastore.ErrNotExist) { + status = 404 + } if errors.Is(err, ErrPermissionDenied) { status = 403 }