diff --git a/CHANGELOG.md b/CHANGELOG.md index 88afdc3..2331f4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.8.1 + +Features: + +- Added a specific `Flexirest::HTTPTooManyRequestsClientException` for 429 errors, to enable easier trapping + ## 1.8.0 Features: diff --git a/lib/flexirest/request.rb b/lib/flexirest/request.rb index fa57f08..e4ab1b6 100644 --- a/lib/flexirest/request.rb +++ b/lib/flexirest/request.rb @@ -584,6 +584,8 @@ def handle_response(response, cached = nil) raise HTTPTimeoutClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method) elsif status == 409 raise HTTPConflictClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method) + elsif status == 409 + raise HTTPTooManyRequestsClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method) elsif (400..499).include? status raise HTTPClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method) elsif (500..599).include? status @@ -841,6 +843,7 @@ class HTTPNotAcceptableClientException < HTTPClientException ; end class HTTPTimeoutClientException < HTTPClientException ; end class HTTPConflictClientException < HTTPClientException ; end class HTTPNotFoundClientException < HTTPClientException ; end + class HTTPTooManyRequestsClientException < HTTPClientException ; end class HTTPServerException < HTTPException ; end end diff --git a/lib/flexirest/version.rb b/lib/flexirest/version.rb index 1b44fe7..9c0c83b 100644 --- a/lib/flexirest/version.rb +++ b/lib/flexirest/version.rb @@ -1,3 +1,3 @@ module Flexirest - VERSION = "1.8.0" + VERSION = "1.8.1" end