diff --git a/pkg/service_internal/service_internal.go b/pkg/service_internal/service_internal.go index 9513793..7826495 100644 --- a/pkg/service_internal/service_internal.go +++ b/pkg/service_internal/service_internal.go @@ -2,8 +2,10 @@ package service_internal import ( "context" - internal "git.itzana.me/strafesnet/maps-service/pkg/internal" + "errors" + "git.itzana.me/strafesnet/maps-service/pkg/datastore" + internal "git.itzana.me/strafesnet/maps-service/pkg/internal" "github.com/nats-io/nats.go" ) @@ -15,6 +17,9 @@ type Service struct { // yay duplicate code func (svc *Service) NewError(ctx context.Context, err error) *internal.ErrorStatusCode { status := 500 + if errors.Is(err, datastore.ErrNotExist) { + status = 404 + } return &internal.ErrorStatusCode{ StatusCode: status, Response: internal.Error{