Do not panic if Begin().Error was ignored (#1830)
This commit is contained in:
parent
9044197ef9
commit
430e1a1860
3
main.go
3
main.go
@ -504,7 +504,8 @@ func (s *DB) Commit() *DB {
|
||||
|
||||
// Rollback rollback a transaction
|
||||
func (s *DB) Rollback() *DB {
|
||||
if db, ok := s.db.(sqlTx); ok && db != nil {
|
||||
var emptySQLTx *sql.Tx
|
||||
if db, ok := s.db.(sqlTx); ok && db != nil && db != emptySQLTx {
|
||||
s.AddError(db.Rollback())
|
||||
} else {
|
||||
s.AddError(ErrInvalidTransaction)
|
||||
|
Loading…
x
Reference in New Issue
Block a user