[MM-61097] Fix errcheck issues in server/channels/app/bot.go (#28785)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e2dca52480
Коммит
f2182d806b
@@ -88,7 +88,7 @@ issues:
|
|||||||
channels/app/app_test.go|\
|
channels/app/app_test.go|\
|
||||||
channels/app/authorization_test.go|\
|
channels/app/authorization_test.go|\
|
||||||
channels/app/auto_responder_test.go|\
|
channels/app/auto_responder_test.go|\
|
||||||
channels/app/bot.go|\
|
channels/app/bot_test.go|\
|
||||||
channels/app/brand.go|\
|
channels/app/brand.go|\
|
||||||
channels/app/busy_test.go|\
|
channels/app/busy_test.go|\
|
||||||
channels/app/channel.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)
|
savedBot, nErr := a.Srv().Store().Bot().Save(bot)
|
||||||
if nErr != nil {
|
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
|
var appErr *model.AppError
|
||||||
switch {
|
switch {
|
||||||
case errors.As(nErr, &appErr): // in case we haven't converted to plain error.
|
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
|
//save the bot
|
||||||
savedBot, nErr := a.Srv().Store().Bot().Save(botDef)
|
savedBot, nErr := a.Srv().Store().Bot().Save(botDef)
|
||||||
if nErr != nil {
|
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
|
var nAppErr *model.AppError
|
||||||
switch {
|
switch {
|
||||||
case errors.As(nErr, &nAppErr): // in case we haven't converted to plain error.
|
case errors.As(nErr, &nAppErr): // in case we haven't converted to plain error.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user