lib/countries/tasks/postal_codes.rake in countries-5.4.0 vs lib/countries/tasks/postal_codes.rake in countries-5.5.0

- old
+ new

@@ -17,10 +17,14 @@ data = yaml[country_code].to_a postal_code_index = data.find_index { |d| d[0] == 'postal_code' } postal_code_format_index = data.find_index { |d| d[0] == 'postal_code_format' } response = URI.open("https://chromium-i18n.appspot.com/ssl-address/data/#{country_code}").read - json = JSON.parse(response) rescue {} + json = begin + JSON.parse(response) + rescue StandardError + {} + end puts ' - Returned empty data. Skipping ' and next if json.empty? postal_code = ['postal_code', !json['zip'].nil?] postal_code_format = ['postal_code_format', json['zip']]