Skip to content

Commit

Permalink
fix: err not handled lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf committed Aug 21, 2024
1 parent d96adee commit ae2e5ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ func WithLogging(handleFn func(http.ResponseWriter, *http.Request) error, log lo
log.Info("request", "method", r.Method, "url", r.URL)
err := handleFn(w, r)
if err != nil { // #nosec G104
w.Write([]byte(err.Error()))
log.Error(err.Error())
_, writeErr := w.Write([]byte(err.Error()))
if writeErr != nil {
log.Error("Error writing error response", "err", writeErr, "originalErr", err)
} else {
log.Error("Error handling request", "err", err)
}
}
}
}
Expand Down

0 comments on commit ae2e5ce

Please sign in to comment.