fix: include body in error message (#10866)

This commit is contained in:
Joshua Powers 2022-03-24 14:03:26 -07:00 committed by GitHub
parent 86cad6c2e2
commit f975f4269e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -357,9 +357,9 @@ func (a *AzureMonitor) send(body []byte) error {
}
defer resp.Body.Close()
_, err = io.ReadAll(resp.Body)
respbody, err := io.ReadAll(resp.Body)
if err != nil || resp.StatusCode < 200 || resp.StatusCode > 299 {
return fmt.Errorf("failed to write batch: [%v] %s", resp.StatusCode, resp.Status)
return fmt.Errorf("failed to write batch: [%v] %s: %s", resp.StatusCode, resp.Status, string(respbody))
}
return nil