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
# 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