Skip to content

Commit ba610b8

Browse files
authored
Merge pull request #84 from benjojo/ServiceFailureError
Handle API backend failures with a better error message (#83)
2 parents 746075f + a46b733 commit ba610b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cloudflare.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func (api *API) makeRequest(method, uri string, params interface{}) ([]byte, err
9898
return nil, errors.Errorf("HTTP status %d: invalid credentials", resp.StatusCode)
9999
case http.StatusForbidden:
100100
return nil, errors.Errorf("HTTP status %d: insufficient permissions", resp.StatusCode)
101+
case http.StatusServiceUnavailable, http.StatusBadGateway, http.StatusGatewayTimeout,
102+
522, 523, 524:
103+
return nil, errors.Errorf("HTTP status %d: service failure", resp.StatusCode)
101104
default:
102105
var s string
103106
if body != nil {

0 commit comments

Comments
 (0)