diff --git a/lib/timezone/lookup/geonames.rb b/lib/timezone/lookup/geonames.rb index ccd6ae0e..49883f76 100644 --- a/lib/timezone/lookup/geonames.rb +++ b/lib/timezone/lookup/geonames.rb @@ -41,8 +41,6 @@ def lookup(lat, long) return if NO_TIMEZONE_INFORMATION == data['status']['value'] raise(Timezone::Error::GeoNames, data['status']['message']) - rescue StandardError => e - raise(Timezone::Error::GeoNames, e.message) end private diff --git a/lib/timezone/lookup/google.rb b/lib/timezone/lookup/google.rb index 56466399..cd2d6238 100644 --- a/lib/timezone/lookup/google.rb +++ b/lib/timezone/lookup/google.rb @@ -44,8 +44,6 @@ def lookup(lat, long) end data['timeZoneId'] - rescue StandardError => e - raise(Timezone::Error::Google, e.message) end private diff --git a/test/timezone/lookup/test_google.rb b/test/timezone/lookup/test_google.rb index b8e5db34..fdbb56a8 100644 --- a/test/timezone/lookup/test_google.rb +++ b/test/timezone/lookup/test_google.rb @@ -39,7 +39,9 @@ def test_google_using_lat_long_coordinates end def test_google_request_denied_read_lat_long_coordinates - mine = lookup(nil) + mine = lookup( + File.open(mock_path + '/google_request_denied.txt').read + ) assert_raises Timezone::Error::Google, 'The provided API key is invalid.' do mine.lookup(*coordinates)