summaryrefslogtreecommitdiffstats
path: root/api4/user.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-31 15:03:16 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-08-31 10:03:16 -0400
commit63b10be020deffecba0c5eef8e5872418215b464 (patch)
tree192c061ba8abc8c07b4241fa1d186c0152f8267a /api4/user.go
parentb37e17c03259b592e0bc735d48d15d7cf34469e4 (diff)
downloadchat-63b10be020deffecba0c5eef8e5872418215b464.tar.gz
chat-63b10be020deffecba0c5eef8e5872418215b464.tar.bz2
chat-63b10be020deffecba0c5eef8e5872418215b464.zip
APIv4: NewLocAppError -> NewAppError (#7328)
Diffstat (limited to 'api4/user.go')
-rw-r--r--api4/user.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/api4/user.go b/api4/user.go
index 2f1c72957..889fe56a3 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -234,19 +234,17 @@ func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
}
if len(*utils.Cfg.FileSettings.DriverName) == 0 {
- c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.storage.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.storage.app_error", nil, "", http.StatusNotImplemented)
return
}
if r.ContentLength > *utils.Cfg.FileSettings.MaxFileSize {
- c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.too_large.app_error", nil, "")
- c.Err.StatusCode = http.StatusRequestEntityTooLarge
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
return
}
if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil {
- c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.parse.app_error", nil, "")
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.parse.app_error", nil, "", http.StatusInternalServerError)
return
}
@@ -254,14 +252,12 @@ func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
imageArray, ok := m.File["image"]
if !ok {
- c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.no_file.app_error", nil, "")
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.no_file.app_error", nil, "", http.StatusBadRequest)
return
}
if len(imageArray) <= 0 {
- c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.array.app_error", nil, "")
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.array.app_error", nil, "", http.StatusBadRequest)
return
}
@@ -650,8 +646,7 @@ func updateUserActive(c *Context, w http.ResponseWriter, r *http.Request) {
isSelfDeactive := !active && c.Params.UserId == c.Session.UserId
if !isSelfDeactive && !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
- c.Err = model.NewLocAppError("updateUserActive", "api.user.update_active.permissions.app_error", nil, "userId="+c.Params.UserId)
- c.Err.StatusCode = http.StatusForbidden
+ c.Err = model.NewAppError("updateUserActive", "api.user.update_active.permissions.app_error", nil, "userId="+c.Params.UserId, http.StatusForbidden)
return
}
@@ -1014,8 +1009,7 @@ func verifyUserEmail(c *Context, w http.ResponseWriter, r *http.Request) {
}
if err := app.VerifyEmailFromToken(token); err != nil {
- c.Err = model.NewLocAppError("verifyUserEmail", "api.user.verify_email.bad_link.app_error", nil, err.Error())
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("verifyUserEmail", "api.user.verify_email.bad_link.app_error", nil, err.Error(), http.StatusBadRequest)
return
} else {
c.LogAudit("Email Verified")