Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Let developers handle errors with freegeoip.net #120

Closed
wants to merge 1 commit into from

2 participants

@lukeledet

I needed to handle timeout errors from freegeoip.net but couldn't because they were being eaten by StandardError.

@alexreisner
Owner

Thanks, Luke. This is merged and will be part of 1.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/geocoder/lookups/freegeoip.rb
View
3  lib/geocoder/lookups/freegeoip.rb
@@ -11,7 +11,8 @@ def results(query, reverse = false)
return [reserved_result(query)] if loopback_address?(query)
begin
return (doc = fetch_data(query, reverse)) ? [doc] : []
- rescue StandardError # Freegeoip.net returns HTML on bad request
+ rescue StandardError => err # Freegeoip.net returns HTML on bad request
+ raise_error(err)
return []
end
end
Something went wrong with that request. Please try again.