Let exceptions propagate to the default handler for ways so they are logged.
This commit is contained in:
parent
ed8b7fde42
commit
e15916ad5b
2 changed files with 36 additions and 59 deletions
|
@ -15,12 +15,9 @@ class WayController < ApplicationController
|
||||||
render :nothing => true, :status => :precondition_failed
|
render :nothing => true, :status => :precondition_failed
|
||||||
else
|
else
|
||||||
way.user_id = @user.id
|
way.user_id = @user.id
|
||||||
|
way.save_with_history!
|
||||||
|
|
||||||
if way.save_with_history
|
|
||||||
render :text => way.id.to_s, :content_type => "text/plain"
|
render :text => way.id.to_s, :content_type => "text/plain"
|
||||||
else
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => :bad_request
|
render :nothing => true, :status => :bad_request
|
||||||
|
@ -41,8 +38,6 @@ class WayController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render :nothing => true, :status => :not_found
|
render :nothing => true, :status => :not_found
|
||||||
rescue
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,12 +56,9 @@ class WayController < ApplicationController
|
||||||
way.tags = new_way.tags
|
way.tags = new_way.tags
|
||||||
way.segs = new_way.segs
|
way.segs = new_way.segs
|
||||||
way.visible = true
|
way.visible = true
|
||||||
|
way.save_with_history!
|
||||||
|
|
||||||
if way.save_with_history
|
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
else
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => :bad_request
|
render :nothing => true, :status => :bad_request
|
||||||
|
@ -76,8 +68,6 @@ class WayController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render :nothing => true, :status => :not_found
|
render :nothing => true, :status => :not_found
|
||||||
rescue
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,19 +80,14 @@ class WayController < ApplicationController
|
||||||
way.tags = []
|
way.tags = []
|
||||||
way.segs = []
|
way.segs = []
|
||||||
way.visible = false
|
way.visible = false
|
||||||
|
way.save_with_history!
|
||||||
|
|
||||||
if way.save_with_history
|
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
else
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => :gone
|
render :nothing => true, :status => :gone
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render :nothing => true, :status => :not_found
|
render :nothing => true, :status => :not_found
|
||||||
rescue
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,8 +121,6 @@ class WayController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render :nothing => true, :status => :not_found
|
render :nothing => true, :status => :not_found
|
||||||
rescue
|
|
||||||
render :nothing => true, :status => :internal_server_error
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,7 @@ class Way < ActiveRecord::Base
|
||||||
@tags[k] = v
|
@tags[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_with_history
|
def save_with_history!
|
||||||
begin
|
|
||||||
Way.transaction do
|
Way.transaction do
|
||||||
t = Time.now
|
t = Time.now
|
||||||
self.timestamp = t
|
self.timestamp = t
|
||||||
|
@ -179,11 +178,6 @@ class Way < ActiveRecord::Base
|
||||||
old_way.timestamp = t
|
old_way.timestamp = t
|
||||||
old_way.save_with_dependencies!
|
old_way.save_with_dependencies!
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
|
||||||
rescue
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def preconditions_ok?
|
def preconditions_ok?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue