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)
| 158 | // httpgrpc errors can bubble up to here and should be translated to http errors. It returns |
| 159 | // httpgrpc error. |
| 160 | func 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 | } |
no test coverage detected