./lib/venice/client.rb in venice-0.5.0 vs ./lib/venice/client.rb in venice-0.6.0
- old
+ new
@@ -93,15 +93,25 @@
response = http.request(request)
rescue Timeout::Error
raise TimeoutError
end
- JSON.parse(response.body)
+ begin
+ JSON.parse(response.body)
+ rescue JSON::ParserError
+ raise InvalidResponseError
+ end
end
end
class Client::TimeoutError < Timeout::Error
def message
'The App Store timed out.'
+ end
+ end
+
+ class Client::InvalidResponseError < StandardError
+ def message
+ 'The App Store returned invalid response'
end
end
end