Allow unwrapping of errors when reading from remote client

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
Jeanette Tan 2025-04-16 03:57:42 +08:00
parent c15140f863
commit 88bf1b1a68

View File

@ -384,7 +384,8 @@ func (c *Client) Read(ctx context.Context, query *prompb.Query, sortSeries bool)
_ = httpResp.Body.Close() _ = httpResp.Body.Close()
cancel() cancel()
return nil, fmt.Errorf("remote server %s returned http status %s: %s", c.urlString, httpResp.Status, string(body)) err := errors.New(string(body))
return nil, fmt.Errorf("remote server %s returned http status %s: %w", c.urlString, httpResp.Status, err)
} }
contentType := httpResp.Header.Get("Content-Type") contentType := httpResp.Header.Get("Content-Type")