MCPcopy
hub / github.com/livekit/livekit / handleError

Function handleError

pkg/service/utils.go:72–81  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...any)

Source from the content-addressed store, hash-verified

70}
71
72func 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
83func HandleError(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...any) {
84 handleError(w, r, status, err, keysAndValues...)

Callers 2

HandleErrorFunction · 0.85
HandleErrorJsonFunction · 0.85

Calls 1

GetLoggerFunction · 0.92

Tested by

no test coverage detected