fix: include body in error message (#10866)
This commit is contained in:
parent
86cad6c2e2
commit
f975f4269e
|
|
@ -357,9 +357,9 @@ func (a *AzureMonitor) send(body []byte) error {
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
_, err = io.ReadAll(resp.Body)
|
respbody, err := io.ReadAll(resp.Body)
|
||||||
if err != nil || resp.StatusCode < 200 || resp.StatusCode > 299 {
|
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
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue