Skip to content

Commit 887bff8

Browse files
committed
[-] fix BeginTx() when returning error
1 parent 7ccae6c commit 887bff8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pgxmock.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ func (c *pgxmock) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx,
362362
if err != nil {
363363
return nil, err
364364
}
365-
return c, ex.waitForDelay(ctx)
365+
if err = ex.waitForDelay(ctx); err != nil {
366+
return nil, err
367+
}
368+
return c, nil
366369
}
367370

368371
func (c *pgxmock) Prepare(ctx context.Context, name, query string) (*pgconn.StatementDescription, error) {

0 commit comments

Comments
 (0)