diff --git a/server/.golangci.yml b/server/.golangci.yml index 8cdc9c2332..dd691c7f3f 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -261,7 +261,6 @@ issues: channels/utils/fileutils/fileutils_test.go|\ channels/utils/license_test.go|\ channels/utils/subpath_test.go|\ - channels/web/handlers.go|\ channels/web/oauth.go|\ channels/web/oauth_test.go|\ channels/web/response_writer_wrapper_test.go|\ diff --git a/server/channels/web/handlers.go b/server/channels/web/handlers.go index f257232160..3294ee7ac0 100644 --- a/server/channels/web/handlers.go +++ b/server/channels/web/handlers.go @@ -450,7 +450,9 @@ func (h Handler) handleContextError(c *Context, w http.ResponseWriter, r *http.R if IsAPICall(c.App, r) || IsWebhookCall(c.App, r) || IsOAuthAPICall(c.App, r) || r.Header.Get("X-Mobile-App") != "" { w.Header().Set("Content-Type", "application/json") w.WriteHeader(c.Err.StatusCode) - w.Write([]byte(c.Err.ToJSON())) + if _, err := w.Write([]byte(c.Err.ToJSON())); err != nil { + c.Logger.Error("Failed to write error response", mlog.Err(err)) + } } else { utils.RenderWebAppError(c.App.Config(), w, r, c.Err, c.App.AsymmetricSigningKey()) }