From 291350850de00bb32080c70e06599bf41eabd782 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 15 Jul 2009 13:34:14 +0000 Subject: [PATCH] Say which way is too long. --- app/models/way.rb | 2 +- lib/osm.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/way.rb b/app/models/way.rb index 8788bd671..e26418732 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -234,7 +234,7 @@ class Way < ActiveRecord::Base def preconditions_ok?(old_nodes = []) return false if self.nds.empty? if self.nds.length > APP_CONFIG['max_number_of_way_nodes'] - raise OSM::APITooManyWayNodesError.new(self.nds.length, APP_CONFIG['max_number_of_way_nodes']) + raise OSM::APITooManyWayNodesError.new(self.id, self.nds.length, APP_CONFIG['max_number_of_way_nodes']) end # check only the new nodes, for efficiency - old nodes having been checked last time and can't diff --git a/lib/osm.rb b/lib/osm.rb index 789a5f439..f36deb0a8 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -187,18 +187,18 @@ module OSM # Raised when a way has more than the configured number of way nodes. # This prevents ways from being to long and difficult to work with class APITooManyWayNodesError < APIError - def initialize(provided, max) - @provided, @max = provided, max + def initialize(id, provided, max) + @id, @provided, @max = id, provided, max end - attr_reader :provided, :max + attr_reader :id, :provided, :max def status :bad_request end def to_s - "You tried to add #{provided} nodes to the way, however only #{max} are allowed" + "You tried to add #{provided} nodes to way #{id}, however only #{max} are allowed" end end -- 2.43.2