Assign transaction error to db

This commit is contained in:
Jinzhu 2021-04-16 19:27:23 +08:00
parent d483ffa45c
commit 7701c88507
1 changed files with 2 additions and 0 deletions

View File

@ -11,6 +11,8 @@ func BeginTransaction(db *gorm.DB) {
db.InstanceSet("gorm:started_transaction", true)
} else if tx.Error == gorm.ErrInvalidTransaction {
tx.Error = nil
} else {
db.Error = tx.Error
}
}
}