Skip to content

Commit

Permalink
Merge pull request alexreisner#168 from galvinhsiu/master
Browse files Browse the repository at this point in the history
In lookups/base, invalid JSON needs to be rescued for ActiveSupport::JSON
  • Loading branch information
alexreisner committed Jan 30, 2012
2 parents 170a934 + b8b5124 commit 59d9349
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/geocoder/lookups/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ def fetch_data(query, reverse = false)
# Parses a raw search result (returns hash or array).
#
def parse_raw_data(raw_data)
if defined?(ActiveSupport::JSON)
ActiveSupport::JSON.decode(raw_data)
else
begin
begin
if defined?(ActiveSupport::JSON)
ActiveSupport::JSON.decode(raw_data)
else
JSON.parse(raw_data)
rescue
warn "Geocoding API's response was not valid JSON."
end
rescue
warn "Geocoding API's response was not valid JSON."
end
end

Expand Down

0 comments on commit 59d9349

Please sign in to comment.