diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-09-25 14:42:06 +0200 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-09-25 08:42:06 -0400 |
commit | 7636650a25462b0eb3e1ca2f35d8c0d914c40820 (patch) | |
tree | 705d570d340436f39c3ae062558df6cea6fced75 /app/admin.go | |
parent | 3785ad48c14c2ab9a8c55127b2f2a04cd8b30d6e (diff) | |
download | chat-7636650a25462b0eb3e1ca2f35d8c0d914c40820.tar.gz chat-7636650a25462b0eb3e1ca2f35d8c0d914c40820.tar.bz2 chat-7636650a25462b0eb3e1ca2f35d8c0d914c40820.zip |
Migrate to idiomatic error handling app/a*.go and app/b*.go (#9455)
Diffstat (limited to 'app/admin.go')
-rw-r--r-- | app/admin.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/admin.go b/app/admin.go index 940d85410..3b7f21dda 100644 --- a/app/admin.go +++ b/app/admin.go @@ -238,14 +238,15 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError { return model.NewAppError("testEmail", "api.admin.test_email.reenter_password", nil, "", http.StatusBadRequest) } } - if user, err := a.GetUser(userId); err != nil { + user, err := a.GetUser(userId) + if err != nil { return err - } else { - T := utils.GetUserTranslations(user.Locale) - license := a.License() - if err := mailservice.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil { - return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) - } + } + + T := utils.GetUserTranslations(user.Locale) + license := a.License() + if err := mailservice.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil { + return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) } return nil |