Add rollback if GetTicInTx fails and move GetTicInTx to shared/repository.go
This commit is contained in:
@@ -34,6 +34,10 @@ func (repository DentRepository) Create(headerID int64, models []interface{}) er
|
||||
|
||||
tic, getTicErr := shared.GetTicInTx(headerID, tx)
|
||||
if getTicErr != nil {
|
||||
rollbackErr := tx.Rollback()
|
||||
if rollbackErr != nil {
|
||||
log.Error("failed to rollback ", rollbackErr)
|
||||
}
|
||||
return getTicErr
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user