[MM-61097] Fix errcheck issues in server/channels/app/bot.go (#28785)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
Rohan Sharma
2024-11-04 13:26:59 +05:30
коммит произвёл GitHub
родитель e2dca52480
Коммит f2182d806b
2 изменённых файлов: 7 добавлений и 3 удалений

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

@@ -88,7 +88,7 @@ issues:
channels/app/app_test.go|\
channels/app/authorization_test.go|\
channels/app/auto_responder_test.go|\
channels/app/bot.go|\
channels/app/bot_test.go|\
channels/app/brand.go|\
channels/app/busy_test.go|\
channels/app/channel.go|\

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

@@ -124,7 +124,9 @@ func (a *App) CreateBot(rctx request.CTX, bot *model.Bot) (*model.Bot, *model.Ap
savedBot, nErr := a.Srv().Store().Bot().Save(bot)
if nErr != nil {
a.Srv().Store().User().PermanentDelete(rctx, bot.UserId)
if err := a.Srv().Store().User().PermanentDelete(rctx, bot.UserId); err != nil {
rctx.Logger().Error("Failed to permanently delete the user after bot save failure", mlog.Err(err))
}
var appErr *model.AppError
switch {
case errors.As(nErr, &appErr): // in case we haven't converted to plain error.
@@ -227,7 +229,9 @@ func (a *App) getOrCreateBot(rctx request.CTX, botDef *model.Bot) (*model.Bot, *
//save the bot
savedBot, nErr := a.Srv().Store().Bot().Save(botDef)
if nErr != nil {
a.Srv().Store().User().PermanentDelete(rctx, savedBot.UserId)
if err := a.Srv().Store().User().PermanentDelete(rctx, savedBot.UserId); err != nil {
rctx.Logger().Error("Failed to permanently delete the user after bot save failure", mlog.Err(err))
}
var nAppErr *model.AppError
switch {
case errors.As(nErr, &nAppErr): // in case we haven't converted to plain error.