lib/ruby_lokalise_api/request.rb in ruby-lokalise-api-9.0.0 vs lib/ruby_lokalise_api/request.rb in ruby-lokalise-api-9.0.1
- old
+ new
@@ -61,10 +61,14 @@
respond_with_error(response.status, body)
end
def respond_with(response, endpoint)
- body = custom_load response.body
+ begin
+ body = custom_load response.body
+ rescue JSON::ParserError
+ respond_with_error(response.status, response.body)
+ end
raise_on_error! response, body
RubyLokaliseApi::Response.new(body, endpoint, response.headers)
end