(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...any)
| 70 | } |
| 71 | |
| 72 | func handleError(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...any) { |
| 73 | keysAndValues = append(keysAndValues, "status", status) |
| 74 | if r != nil && r.URL != nil { |
| 75 | keysAndValues = append(keysAndValues, "method", r.Method, "path", r.URL.Path) |
| 76 | } |
| 77 | if !errors.Is(err, context.Canceled) && !errors.Is(r.Context().Err(), context.Canceled) { |
| 78 | utils.GetLogger(r.Context()).WithCallDepth(1).Warnw("error handling request", err, keysAndValues...) |
| 79 | } |
| 80 | w.WriteHeader(status) |
| 81 | } |
| 82 | |
| 83 | func HandleError(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...any) { |
| 84 | handleError(w, r, status, err, keysAndValues...) |
no test coverage detected