Skip to content
Snippets Groups Projects
Commit 4b6f9962 authored by Alex Reisner's avatar Alex Reisner
Browse files

Avoid JSON::ParseError undefined constant error.

parent f5474062
No related branches found
No related tags found
No related merge requests found
...@@ -67,10 +67,10 @@ module Geocoder ...@@ -67,10 +67,10 @@ 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?(JSON) if defined?(JSON) and defined?(JSON.parse)
begin begin
JSON.parse(raw_data) JSON.parse(raw_data)
rescue JSON::ParseError rescue
warn "Geocoding API's response was not valid JSON." warn "Geocoding API's response was not valid JSON."
end end
elsif defined?(ActiveSupport::JSON) elsif defined?(ActiveSupport::JSON)
......
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