Skip to content

Commit

Permalink
fix: return correct error on db transaction rollback failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ravisuhag committed Nov 1, 2024
1 parent d149a39 commit 9327062
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c Client) WithTxn(ctx context.Context, txnOptions sql.TxOptions, txFunc fu
err = txn.Rollback()
panic(p)
} else if err != nil {
if rlbErr := txn.Rollback(); err != nil {
if rlbErr := txn.Rollback(); rlbErr != nil {
err = fmt.Errorf("rollback error: %s while executing: %w", rlbErr, err)
} else {
err = fmt.Errorf("rollback: %w", err)
Expand Down

0 comments on commit 9327062

Please sign in to comment.