Skip to content

Commit

Permalink
Fix errcheck issues in server/channels/web/web.go (mattermost#28911)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ranjana761 authored Oct 29, 2024
1 parent c7e1820 commit 5dba6e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ issues:
channels/web/oauth_test.go|\
channels/web/saml.go|\
channels/web/static.go|\
channels/web/web.go|\
channels/web/web_test.go|\
channels/web/webhook.go|\
cmd/mattermost/commands/cmdtestlib.go|\
Expand Down
8 changes: 6 additions & 2 deletions server/channels/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func Handle404(a app.AppIface, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(err.StatusCode)
err.DetailedError = "There doesn't appear to be an api call for the url='" + r.URL.Path + "'. Typo? are you missing a team_id or user_id as part of the url?"
w.Write([]byte(err.ToJSON()))
if _, writeErr := w.Write([]byte(err.ToJSON())); writeErr != nil {
mlog.Warn("Error writing 404 response", mlog.Err(writeErr))
}
} else if *a.Config().ServiceSettings.WebserverMode == "disabled" {
http.NotFound(w, r)
} else {
Expand Down Expand Up @@ -103,5 +105,7 @@ func IsOAuthAPICall(a app.AppIface, r *http.Request) bool {
func ReturnStatusOK(w http.ResponseWriter) {
m := make(map[string]string)
m[model.STATUS] = model.StatusOk
w.Write([]byte(model.MapToJSON(m)))
if _, err := w.Write([]byte(model.MapToJSON(m))); err != nil {
mlog.Warn("Error writing status OK response", mlog.Err(err))
}
}

0 comments on commit 5dba6e0

Please sign in to comment.