(w http.ResponseWriter, err error)
| 382 | } |
| 383 | |
| 384 | func handleError(w http.ResponseWriter, err error) { |
| 385 | if err == nil { |
| 386 | return |
| 387 | } |
| 388 | |
| 389 | if errors.Is(err, context.Canceled) { |
| 390 | // todo: context is also canceled when we hit the query timeout. research what the behavior is |
| 391 | // ignore this error. we regularly cancel context once queries are complete |
| 392 | return |
| 393 | } |
| 394 | |
| 395 | // TODO: better understand all errors returned from queriers and categorize more as 4XX |
| 396 | // NOTE: we receive a GRPC error from the ingesters, and so we need to check the string content of error as well. |
| 397 | if errors.Is(err, trace.ErrTraceTooLarge) || strings.Contains(err.Error(), trace.ErrTraceTooLarge.Error()) { |
| 398 | http.Error(w, err.Error(), http.StatusUnprocessableEntity) |
| 399 | return |
| 400 | } |
| 401 | |
| 402 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 403 | } |
| 404 | |
| 405 | func writeFormattedContentForRequest(w http.ResponseWriter, req *http.Request, m proto.Message, span oteltrace.Span) { |
| 406 | // Check for both explicit nil and typed nil pointers (e.g., (*tempopb.SearchResponse)(nil)) |
no test coverage detected