From e85d92ec364548ad251c8ab3a4c70d460ed0e13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Thu, 12 Feb 2026 13:47:00 +0400 Subject: [PATCH] Wrap errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/iam/organization_service.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkg/iam/organization_service.go b/pkg/iam/organization_service.go index 29cc2a7f6..f54f35429 100644 --- a/pkg/iam/organization_service.go +++ b/pkg/iam/organization_service.go @@ -1008,15 +1008,13 @@ func (s *OrganizationService) UpdateProfile(ctx context.Context, req *UpdateProf profile.ContractEndDate = *req.ContractEndDate } - if profile.ContractStartDate != nil && profile.ContractEndDate != nil { - if profile.ContractEndDate.Before(*profile.ContractStartDate) { - return fmt.Errorf("contract end date must be after or equal to start date") - } - } - profile.UpdatedAt = time.Now() - return profile.Update(ctx, conn, scope) + if err := profile.Update(ctx, conn, scope); err != nil { + return fmt.Errorf("cannot update profile: %w", err) + } + + return nil }, ) @@ -1033,7 +1031,11 @@ func (s *OrganizationService) GetProfile(ctx context.Context, profileID gid.GID) err := s.pg.WithConn( ctx, func(conn pg.Conn) error { - return profile.LoadByID(ctx, conn, coredata.NewScopeFromObjectID(profileID), profileID) + if err := profile.LoadByID(ctx, conn, coredata.NewScopeFromObjectID(profileID), profileID); err != nil { + return fmt.Errorf("cannot load profile: %w", err) + } + + return nil }, ) @@ -1058,7 +1060,11 @@ func (s *OrganizationService) ListProfiles( err := s.pg.WithConn( ctx, func(conn pg.Conn) error { - return profiles.LoadByOrganizationID(ctx, conn, scope, organizationID, cursor, filter) + if err := profiles.LoadByOrganizationID(ctx, conn, scope, organizationID, cursor, filter); err != nil { + return fmt.Errorf("cannot load profiles: %w", err) + } + + return nil }, )