diff --git a/CHANGELOG.md b/CHANGELOG.md index a6639b5..53d1152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog +## 4.20.1 (2026-10-13) + +### Fixes + +#### Fix crash on string error bodies and unrecognised error types + +Error responses whose `error` is a plain string, with a status other than 400, 401, 403 or 429 (for example a 404 or 422), previously raised `NoMethodError: undefined method 'to_sym' for nil` instead of a GoCardless error. They now raise `GoCardlessPro::ApiError` with the message from the response. + +Error responses with an unrecognised `type` now also raise `GoCardlessPro::ApiError` instead of `KeyError`. + +`code` is now set to the HTTP status for string error bodies. It was previously `nil`. + ## 4.20.0 (2026-10-12) ### Features diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index cb9b7cf..79e97ac 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -283,7 +283,7 @@ def default_options 'User-Agent' => "#{user_agent}", 'Content-Type' => 'application/json', 'GoCardless-Client-Library' => 'gocardless-pro-ruby', - 'GoCardless-Client-Version' => '4.20.0', + 'GoCardless-Client-Version' => '4.20.1', }, } end diff --git a/lib/gocardless_pro/version.rb b/lib/gocardless_pro/version.rb index 4a9c49f..658627a 100644 --- a/lib/gocardless_pro/version.rb +++ b/lib/gocardless_pro/version.rb @@ -3,5 +3,5 @@ module GoCardlessPro module GoCardlessPro # Current version of the GC gem - VERSION = '4.20.0' + VERSION = '4.20.1' end