summaryrefslogtreecommitdiffstats
path: root/api/reaction.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-09-01 14:58:43 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-09-01 09:58:43 -0400
commit75c63344def7a108f1257b99e0342330da882a38 (patch)
treea5090e735eacf2d4dea4877a3b84e1f276e1f66b /api/reaction.go
parent718da3593b6feb1c3546b1e17c30c22990157ed5 (diff)
downloadchat-75c63344def7a108f1257b99e0342330da882a38.tar.gz
chat-75c63344def7a108f1257b99e0342330da882a38.tar.bz2
chat-75c63344def7a108f1257b99e0342330da882a38.zip
Api: NewLocAppError -> NewAppError (#7280)
Diffstat (limited to 'api/reaction.go')
-rw-r--r--api/reaction.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/api/reaction.go b/api/reaction.go
index e6f7e845d..df095b8b2 100644
--- a/api/reaction.go
+++ b/api/reaction.go
@@ -29,8 +29,7 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
}
if reaction.UserId != c.Session.UserId {
- c.Err = model.NewLocAppError("saveReaction", "api.reaction.save_reaction.user_id.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ c.Err = model.NewAppError("saveReaction", "api.reaction.save_reaction.user_id.app_error", nil, "", http.StatusForbidden)
return
}
@@ -59,9 +58,8 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = result.Err
return
} else if post = result.Data.(*model.PostList).Posts[postId]; post.ChannelId != channelId {
- c.Err = model.NewLocAppError("saveReaction", "api.reaction.save_reaction.mismatched_channel_id.app_error",
- nil, "channelId="+channelId+", post.ChannelId="+post.ChannelId+", postId="+postId)
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("saveReaction", "api.reaction.save_reaction.mismatched_channel_id.app_error",
+ nil, "channelId="+channelId+", post.ChannelId="+post.ChannelId+", postId="+postId, http.StatusBadRequest)
return
}
@@ -82,8 +80,7 @@ func deleteReaction(c *Context, w http.ResponseWriter, r *http.Request) {
}
if reaction.UserId != c.Session.UserId {
- c.Err = model.NewLocAppError("deleteReaction", "api.reaction.delete_reaction.user_id.app_error", nil, "")
- c.Err.StatusCode = http.StatusForbidden
+ c.Err = model.NewAppError("deleteReaction", "api.reaction.delete_reaction.user_id.app_error", nil, "", http.StatusForbidden)
return
}
@@ -158,9 +155,8 @@ func listReactions(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = result.Err
return
} else if post := result.Data.(*model.PostList).Posts[postId]; post.ChannelId != channelId {
- c.Err = model.NewLocAppError("listReactions", "api.reaction.list_reactions.mismatched_channel_id.app_error",
- nil, "channelId="+channelId+", post.ChannelId="+post.ChannelId+", postId="+postId)
- c.Err.StatusCode = http.StatusBadRequest
+ c.Err = model.NewAppError("listReactions", "api.reaction.list_reactions.mismatched_channel_id.app_error",
+ nil, "channelId="+channelId+", post.ChannelId="+post.ChannelId+", postId="+postId, http.StatusBadRequest)
return
}