lib/active_merchant/billing/gateways/paymill.rb in activemerchant-1.42.9 vs lib/active_merchant/billing/gateways/paymill.rb in activemerchant-1.43.0
- old
+ new
@@ -64,10 +64,14 @@
def commit(method, url, parameters=nil)
begin
raw_response = ssl_request(method, "https://api.paymill.com/v2/#{url}", post_data(parameters), headers)
rescue ResponseError => e
- parsed = JSON.parse(e.response.body)
+ begin
+ parsed = JSON.parse(e.response.body)
+ rescue JSON::ParserError
+ return Response.new(false, "Unable to parse error response: '#{e.response.body}'")
+ end
return Response.new(false, response_message(parsed), parsed, {})
end
response_from(raw_response)
end