From 1116de7608d18893f24dfba70eff709a4e564bd2 Mon Sep 17 00:00:00 2001 From: Mihaela Balutoiu Date: Mon, 10 Oct 2022 13:23:23 +0300 Subject: [PATCH] Fixed error wrap The error is not wrapped correctly, because instead of using `q.Error`, it uses `err`, which is defined elsewhere. Also, the `UpdateOrganization` and `CreateOrganizationPool` functions will never fail on update/create org, because it returns a nil error, instead of wrap error. Signed-off-by: Mihaela Balutoiu --- database/sql/organizations.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/sql/organizations.go b/database/sql/organizations.go index 36a810c9..78f989fa 100644 --- a/database/sql/organizations.go +++ b/database/sql/organizations.go @@ -117,7 +117,7 @@ func (s *sqlDatabase) UpdateOrganization(ctx context.Context, orgID string, para q := s.conn.Save(&org) if q.Error != nil { - return params.Organization{}, errors.Wrap(err, "saving org") + return params.Organization{}, errors.Wrap(q.Error, "saving org") } newParams := s.sqlToCommonOrganization(org) @@ -188,7 +188,7 @@ func (s *sqlDatabase) CreateOrganizationPool(ctx context.Context, orgId string, q := s.conn.Create(&newPool) if q.Error != nil { - return params.Pool{}, errors.Wrap(err, "adding pool") + return params.Pool{}, errors.Wrap(q.Error, "adding pool") } for _, tt := range tags {