diff --git a/providers/dns/dyn/dyn.go b/providers/dns/dyn/dyn.go index 384bc850..277dffb9 100644 --- a/providers/dns/dyn/dyn.go +++ b/providers/dns/dyn/dyn.go @@ -87,11 +87,8 @@ func (d *DNSProvider) sendRequest(method, resource string, payload interface{}) } defer resp.Body.Close() - if resp.StatusCode >= 400 { + if resp.StatusCode >= 500 { return nil, fmt.Errorf("Dyn API request failed with HTTP status code %d", resp.StatusCode) - } else if resp.StatusCode == 307 { - // TODO add support for HTTP 307 response and long running jobs - return nil, fmt.Errorf("Dyn API request returned HTTP 307. This is currently unsupported") } var dynRes dynResponse @@ -100,6 +97,13 @@ func (d *DNSProvider) sendRequest(method, resource string, payload interface{}) return nil, err } + if resp.StatusCode >= 400 { + return nil, fmt.Errorf("Dyn API request failed with HTTP status code %d: %s", resp.StatusCode, dynRes.Messages) + } else if resp.StatusCode == 307 { + // TODO add support for HTTP 307 response and long running jobs + return nil, fmt.Errorf("Dyn API request returned HTTP 307. This is currently unsupported") + } + if dynRes.Status == "failure" { // TODO add better error handling return nil, fmt.Errorf("Dyn API request failed: %s", dynRes.Messages)