From 7636650a25462b0eb3e1ca2f35d8c0d914c40820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 25 Sep 2018 14:42:06 +0200 Subject: Migrate to idiomatic error handling app/a*.go and app/b*.go (#9455) --- app/admin.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app/admin.go') 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 -- cgit v1.2.3-1-g7c22