]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/relation.rb
api06: simplify exception handling and add exception handling to the diff
[rails.git] / app / models / relation.rb
index b7cb0f15bc43d35bf00703d3c7ddb8881f29e0bc..984732c71c98f6b0bc9c1463029135fb2345f64a 100644 (file)
@@ -224,6 +224,8 @@ class Relation < ActiveRecord::Base
   def update_from(new_relation, user)
     if !new_relation.preconditions_ok?
       raise OSM::APIPreconditionFailedError.new
+    elsif new_relation.version != version
+      raise OSM::APIVersionMismatchError.new(new_relation.version, version)
     else
       self.user_id = user.id
       self.tags = new_relation.tags