X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/561ee71129c7d40380d384ce93c1f062651de32b..b5679e16dbd338731c5205bd71c0f5c4f344e6ed:/lib/osm.rb diff --git a/lib/osm.rb b/lib/osm.rb index 73513c3ad..905f3ac97 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -353,6 +353,17 @@ module OSM end end + # Raised when a rate limit is exceeded + class APIRateLimitExceeded < APIError + def initialize + super "Rate limit exceeded" + end + + def status + :too_many_requests + end + end + # Helper methods for going to/from mercator and lat/lng. class Mercator include Math @@ -520,7 +531,7 @@ module OSM # Return the HTTP client to use def self.http_client - @http_client ||= Faraday.new + @http_client ||= Faraday.new(:request => { :timeout => 15 }) end # Return the MaxMindDB database handle