From c4094006670bfe69f9958fa484a5f119c1532553 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 30 Aug 2024 15:17:34 +0200 Subject: [PATCH] Don't overwrite UserVisibleError when updating selectors fails We would return a UserVisibleError when updating selectors, but then overwrite it in the caller who caled the validation, which resulted in the server returning a 500 HTTP code to the client. --- internal/profiles/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/profiles/service.go b/internal/profiles/service.go index 8bb8e4ddcc..6a6abae5bc 100644 --- a/internal/profiles/service.go +++ b/internal/profiles/service.go @@ -285,7 +285,7 @@ func (p *profileService) UpdateProfile( } if err := p.updateSelectors(ctx, updatedProfile.ID, qtx, profile.GetSelection()); err != nil { - return nil, status.Errorf(codes.Internal, "error updating profile: %v", err) + return nil, err } logger.BusinessRecord(ctx).Profile = logger.Profile{Name: updatedProfile.Name, ID: updatedProfile.ID}