X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/53817fa9e8d955df0891d156f21b7269b4ed08fc..ea3760f94d9d74d3aaa8492182b9e1a15ec1effa:/lib/osm.rb diff --git a/lib/osm.rb b/lib/osm.rb index 65eab6907..46f37036f 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -8,7 +8,7 @@ module OSM # The base class for API Errors. class APIError < RuntimeError def initialize(message = "Generic API Error") - super(message) + super end def status @@ -364,6 +364,17 @@ module OSM end end + # Raised when a size limit is exceeded + class APISizeLimitExceeded < APIError + def initialize + super("Size limit exceeded") + end + + def status + :payload_too_large + end + end + # Helper methods for going to/from mercator and lat/lng. class Mercator include Math @@ -524,7 +535,8 @@ module OSM # Return the HTTP client to use def self.http_client - @http_client ||= Faraday.new(:request => { :timeout => 15 }) + @http_client ||= Faraday.new(:request => { :timeout => 15 }, + :headers => { :user_agent => Settings.server_url }) end # Return the MaxMindDB database handle