- if way.tags!=attributes or way.nds!=nodes or !way.visible?
- new_way = Way.new
- new_way.tags = attributes
- new_way.nds = nodes
- new_way.changeset_id = changeset
- new_way.version = version
- way.update_from(new_way, user)
- end
-
- [0, originalway, way.id, renumberednodes, way.version]
+ [0, '', originalway, way.id, renumberednodes, way.version, nodeversions, deletednodes]
+ rescue OSM::APIChangesetAlreadyClosedError => ex
+ return [-1, "Sorry, your changeset #{ex.changeset.id} was closed (at #{ex.changeset.closed_at}).", originalway, originalway, renumberednodes, wayversion, nodeversions, deletednodes]
+ rescue OSM::APIVersionMismatchError => ex
+ a=ex.to_s.match(/(\d+) of (\w+) (\d+)$/)
+ return [-3, ['way', a[1], a[2].downcase, a[3]], originalway, originalway, renumberednodes, wayversion, nodeversions, deletednodes]
+ rescue OSM::APITooManyWayNodesError => ex
+ return [-1, "You have tried to upload a really long way with #{ex.provided} points: only #{ex.max} are allowed.", originalway, originalway, renumberednodes, wayversion, nodeversions, deletednodes]
+ rescue OSM::APIAlreadyDeletedError => ex
+ return [-1, "The point has already been deleted.", originalway, originalway, renumberednodes, wayversion, nodeversions, deletednodes]
+ rescue OSM::APIError => ex
+ # Some error that we don't specifically catch
+ return [-2, "An unusual error happened (in 'putway' #{originalway}). The server said: #{ex}", originalway, originalway, renumberednodes, wayversion, nodeversions, deletednodes]