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
Branches
Tags
No related merge requests found
...@@ -120,16 +120,16 @@ module Geocoder ...@@ -120,16 +120,16 @@ 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)
begin
if defined?(ActiveSupport::JSON) if defined?(ActiveSupport::JSON)
ActiveSupport::JSON.decode(raw_data) ActiveSupport::JSON.decode(raw_data)
else else
begin
JSON.parse(raw_data) JSON.parse(raw_data)
end
rescue rescue
warn "Geocoding API's response was not valid JSON." warn "Geocoding API's response was not valid JSON."
end end
end end
end
## ##
# Protocol to use for communication with geocoding services. # Protocol to use for communication with geocoding services.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment