Give a nice error message when parsing the nwr tags and they are missing the k and/or v. Also includes tests.

This commit is contained in:
Shaun McDonald 2009-06-11 11:08:37 +00:00
parent b7d004e817
commit 65eb6af303
6 changed files with 96 additions and 2 deletions

View file

@ -60,6 +60,8 @@ class Relation < ActiveRecord::Base
relation.visible = true
pt.find('tag').each do |tag|
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag['k'].nil?
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag['v'].nil?
relation.add_tag_keyval(tag['k'], tag['v'])
end