MM-45994 ensure database operations return their errors (#20857)

Этот коммит содержится в:
Tim Scheuermann
2022-08-26 11:12:59 +02:00
коммит произвёл GitHub
родитель c72e9131f4
Коммит eb37139f16
29 изменённых файлов: 326 добавлений и 248 удалений

Просмотреть файл

@@ -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