lib/daywalker/base.rb in technicalpickles-daywalker-0.1.0 vs lib/daywalker/base.rb in technicalpickles-daywalker-0.1.1
- old
+ new
@@ -6,10 +6,15 @@
protected
def self.handle_response(response)
case response.code.to_i
when 403 then raise BadApiKey
- when 200 then parse(response.body)
+ when 200
+ begin
+ parse(response.body)
+ rescue => e
+ raise "Error while parsing #{response.body.inspect} => #{e.inspect}"
+ end
when 400 then handle_bad_request(response.body)
else raise "Don't know how to handle code #{response.code.inspect}"
end
end