[MM-31359] remove duplicated error logs (#16583)

* remove duplicated error logs

* reflect review comments

* add context

* add error details
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-12-29 09:48:36 +03:00
коммит произвёл GitHub
родитель 727a158e9a
Коммит 40e16ba07f
19 изменённых файлов: 16 добавлений и 47 удалений

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

@@ -58,7 +58,6 @@ func (a *App) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError) {
ownerUser, err := a.Srv().Store.User().Get(bot.OwnerId)
var nfErr *store.ErrNotFound
if err != nil && !errors.As(err, &nfErr) {
mlog.Error(err.Error())
return nil, model.NewAppError("CreateBot", "app.user.get.app_error", nil, err.Error(), http.StatusInternalServerError)
} else if ownerUser != nil {
// Send a message to the bot's creator to inform them that the bot needs to be added
@@ -88,14 +87,12 @@ func (a *App) getOrCreateWarnMetricsBot(botDef *model.Bot) (*model.Bot, *model.A
botUser, appErr := a.GetUserByUsername(botDef.Username)
if appErr != nil {
if appErr.StatusCode != http.StatusNotFound {
mlog.Error(appErr.Error())
return nil, appErr
}
// cannot find this bot user, save the user
user, nErr := a.Srv().Store.User().Save(model.UserFromBot(botDef))
if nErr != nil {
mlog.Error(nErr.Error())
var appError *model.AppError
var invErr *store.ErrInvalidInput
switch {