From 00e6b3de7bf7d75e208d69a12d9b62ebaa71b636 Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Sat, 10 Dec 2022 02:13:58 +0100 Subject: [PATCH] Fix fmt.Errorf issue in PostPhoto --- service/database/db-photos.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/service/database/db-photos.go b/service/database/db-photos.go index ae3dfea..3ff7607 100644 --- a/service/database/db-photos.go +++ b/service/database/db-photos.go @@ -18,7 +18,8 @@ func (db *appdbimpl) PostPhoto(uid string) (DBTransaction, int64, error) { err_rb := tx.Rollback() // If rollback fails, we return the original error plus the rollback error if err_rb != nil { - err = fmt.Errorf("%w; %w", err, err_rb) + // todo: we are losing track of err_rb here + err = fmt.Errorf("Rollback error. Rollback cause: %w", err) } return nil, 0, err @@ -29,7 +30,8 @@ func (db *appdbimpl) PostPhoto(uid string) (DBTransaction, int64, error) { err_rb := tx.Rollback() // If rollback fails, we return the original error plus the rollback error if err_rb != nil { - err = fmt.Errorf("%w; %w", err, err_rb) + // todo: we are losing track of err_rb here + err = fmt.Errorf("Rollback error. Rollback cause: %w", err) } return nil, 0, err