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 удалений

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

@@ -144,7 +144,7 @@ func (us SqlBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, error)
bots := []*model.Bot{}
if err := us.GetReplicaX().Select(&bots, sql, args...); err != nil {
return nil, errors.Wrap(err, "select")
return nil, errors.Wrap(err, "error selecting all bots")
}
return bots, nil
@@ -215,7 +215,7 @@ func (us SqlBotStore) Update(bot *model.Bot) (*model.Bot, error) {
func (us SqlBotStore) PermanentDelete(botUserId string) error {
query := "DELETE FROM Bots WHERE UserId = ?"
if _, err := us.GetMasterX().Exec(query, botUserId); err != nil {
return store.NewErrInvalidInput("Bot", "UserId", botUserId)
return store.NewErrInvalidInput("Bot", "UserId", botUserId).Wrap(err)
}
return nil
}