lib/trav3/result.rb in trav3-0.2.3 vs lib/trav3/result.rb in trav3-0.2.4
- old
+ new
@@ -35,10 +35,14 @@
:connection_close?, :connection_keep_alive?,
:initialize_http_header, :get_fields, :each_header
def initialize(travis, response)
@travis = travis
@response = response
- @json = JSON.parse(response.body)
+ @json = begin
+ JSON.parse(response.body)
+ rescue JSON::ParserError
+ response.error!
+ end
end
def inspect
"<#{self.class} Response: keys = #{keys}>"
end