Improve error output for Cloudflare

Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
This commit is contained in:
Maartje Eyskens 2020-07-16 10:13:57 +02:00
parent 36a14544e0
commit 02ba02167a

View File

@ -236,7 +236,7 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM
}
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("Error querying Cloudflare API -> %v", err)
return nil, fmt.Errorf("Error querying Cloudflare API for %s %q -> %v", method, uri, err)
}
defer resp.Body.Close()
@ -256,9 +256,9 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM
errStr += fmt.Sprintf("<- %d: %s", chainErr.Code, chainErr.Message)
}
}
return nil, fmt.Errorf("Cloudflare API Error \n%s", errStr)
return nil, fmt.Errorf("Cloudflare API Error for %s %q \n%s", method, uri, errStr)
}
return nil, fmt.Errorf("Cloudflare API error")
return nil, fmt.Errorf("Cloudflare API error for %s %q", method, uri)
}
return r.Result, nil