lib/ayadn/nicerank.rb in ayadn-2.0.11 vs lib/ayadn/nicerank.rb in ayadn-2.0.12

- old
+ new

@@ -27,10 +27,16 @@ user_ids.uniq! got = CNX.get "#{@url}#{user_ids.join(',')}&show_details=Y" unless user_ids.empty? if got.nil? || got == "" parsed = {'meta' => {'code' => 404}, 'data' => []} else - parsed = JSON.parse(got) + + begin + parsed = JSON.parse(got) + rescue JSON::ParserError => e + parsed = {'meta' => {'code' => 404}, 'data' => []} + end + end parsed['data'].each do |obj| res = @store[obj['user_id']] if res.nil? obj['account']['is_human'] == true ? is_human = 1 : is_human = 0