MCPcopy
hub / github.com/grafana/tempo / writeError

Function writeError

modules/frontend/handler.go:160–170  ·  view source on GitHub ↗

writeError handles writing errors to the http.ResponseWriter. It uses dskit's httpgrpc.WriteError() to handle httpgrc errors. The handler handles all incoming HTTP requests to the query frontend which then distributes them via httpgrpc to the queriers. As a result httpgrpc errors can bubble up to he

(w http.ResponseWriter, err error)

Source from the content-addressed store, hash-verified

158// httpgrpc errors can bubble up to here and should be translated to http errors. It returns
159// httpgrpc error.
160func writeError(w http.ResponseWriter, err error) error {
161 if grpcutil.IsCanceled(err) {
162 err = errCanceled
163 } else if errors.Is(err, context.DeadlineExceeded) {
164 err = errDeadlineExceeded
165 } else if util.IsRequestBodyTooLarge(err) {
166 err = errRequestEntityTooLarge
167 }
168 httpgrpc.WriteError(w, err)
169 return err
170}

Callers 1

ServeHTTPMethod · 0.70

Calls 1

IsRequestBodyTooLargeFunction · 0.92

Tested by

no test coverage detected