MM-45994 ensure database operations return their errors (#20857)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c72e9131f4
Коммит
eb37139f16
@@ -124,14 +124,14 @@ func (s SqlSystemStore) PermanentDeleteByName(name string) (*model.System, error
|
||||
|
||||
// InsertIfExists inserts a given system value if it does not already exist. If a value
|
||||
// already exists, it returns the old one, else returns the new one.
|
||||
func (s SqlSystemStore) InsertIfExists(system *model.System) (*model.System, error) {
|
||||
func (s SqlSystemStore) InsertIfExists(system *model.System) (_ *model.System, err error) {
|
||||
tx, err := s.GetMasterX().BeginXWithIsolation(&sql.TxOptions{
|
||||
Isolation: sql.LevelSerializable,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "begin_transaction")
|
||||
}
|
||||
defer finalizeTransactionX(tx)
|
||||
defer finalizeTransactionX(tx, &err)
|
||||
|
||||
var origSystem model.System
|
||||
if err := tx.Get(&origSystem, `SELECT * FROM Systems
|
||||
|
||||
Ссылка в новой задаче
Block a user