Skip to content
Snippets Groups Projects
Commit b8b51246 authored by Galvin Hsiu's avatar Galvin Hsiu
Browse files

Fix for parse_raw_data -- json parse catches invalid json and...

Fix for parse_raw_data -- json parse catches invalid json and activesupport::json needs to be caught.
parent 170a934a
No related branches found
No related tags found
No related merge requests found
...@@ -120,14 +120,14 @@ module Geocoder ...@@ -120,14 +120,14 @@ module Geocoder
# Parses a raw search result (returns hash or array). # Parses a raw search result (returns hash or array).
# #
def parse_raw_data(raw_data) def parse_raw_data(raw_data)
if defined?(ActiveSupport::JSON) begin
ActiveSupport::JSON.decode(raw_data) if defined?(ActiveSupport::JSON)
else ActiveSupport::JSON.decode(raw_data)
begin else
JSON.parse(raw_data) JSON.parse(raw_data)
rescue
warn "Geocoding API's response was not valid JSON."
end end
rescue
warn "Geocoding API's response was not valid JSON."
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment