submissions: return 404 when ErrNotExist
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Quaternions 2024-12-17 14:36:44 -08:00
parent 332578ec94
commit f4abc30c21

View File

@ -25,6 +25,9 @@ type Service struct {
// Used for common default response. // Used for common default response.
func (svc *Service) NewError(ctx context.Context, err error) *api.ErrorStatusCode { func (svc *Service) NewError(ctx context.Context, err error) *api.ErrorStatusCode {
status := 500 status := 500
if errors.Is(err, datastore.ErrNotExist) {
status = 404
}
if errors.Is(err, ErrPermissionDenied) { if errors.Is(err, ErrPermissionDenied) {
status = 403 status = 403
} }