From 845159d501a400a517d7d771de1881911921a33a Mon Sep 17 00:00:00 2001 From: Rohan Sharma <117426013+RS-labhub@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:55:34 +0530 Subject: [PATCH] fix: reaction errcheck issues (#28513) --- server/.golangci.yml | 3 ++- server/channels/api4/reaction.go | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 423827d5f6..059a3ed009 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -89,7 +89,8 @@ issues: channels/api4/plugin.go|\ channels/api4/plugin_test.go|\ channels/api4/post_test.go|\ - channels/api4/reaction.go|\ + channels/api4/preference_test.go|\ + channels/api4/reaction_test.go|\ channels/api4/remote_cluster.go|\ channels/api4/role.go|\ channels/api4/role_test.go|\ diff --git a/server/channels/api4/reaction.go b/server/channels/api4/reaction.go index 9b6cfcbfc9..a9fb7c0e7d 100644 --- a/server/channels/api4/reaction.go +++ b/server/channels/api4/reaction.go @@ -74,7 +74,9 @@ func getReactions(c *Context, w http.ResponseWriter, r *http.Request) { return } - w.Write(js) + if _, err := w.Write(js); err != nil { + c.Logger.Warn("Error while writing js response", mlog.Err(err)) + } } func deleteReaction(c *Context, w http.ResponseWriter, r *http.Request) { @@ -131,5 +133,7 @@ func getBulkReactions(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = model.NewAppError("getBulkReactions", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err) return } - w.Write(js) + if _, err := w.Write(js); err != nil { + c.Logger.Warn("Error while writing js response", mlog.Err(err)) + } }