From 4b6f9962b2a11c699b8172a6716921fde4a131ca Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Sat, 5 Mar 2011 18:31:40 -0500 Subject: [PATCH] Avoid JSON::ParseError undefined constant error. --- lib/geocoder/lookups/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/geocoder/lookups/base.rb b/lib/geocoder/lookups/base.rb index c07080f5..8b2ddd11 100644 --- a/lib/geocoder/lookups/base.rb +++ b/lib/geocoder/lookups/base.rb @@ -67,10 +67,10 @@ module Geocoder # Parses a raw search result (returns hash or array). # def parse_raw_data(raw_data) - if defined?(JSON) + if defined?(JSON) and defined?(JSON.parse) begin JSON.parse(raw_data) - rescue JSON::ParseError + rescue warn "Geocoding API's response was not valid JSON." end elsif defined?(ActiveSupport::JSON) -- GitLab